From bbf4d657e77fd39887b9941af1fe75a5ec27d988 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 29 Mar 2009 20:35:19 -0600 Subject: Fix up eAthena party handling some more --- src/net/ea/gui/partytab.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-) (limited to 'src/net/ea/gui/partytab.cpp') diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index 4e486bf0..9759962a 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -45,9 +45,73 @@ PartyTab::~PartyTab() } void PartyTab::handleInput(const std::string &msg) { - // TODO + std::size_t length = msg.length() + 1; + + MessageOut outMsg(CMSG_PARTY_MESSAGE); + outMsg.writeInt16(length + 4); + outMsg.writeString(msg, length); } void PartyTab::handleCommand(std::string msg) { - // TODO + std::string::size_type pos = msg.find(' '); + std::string type(msg, 0, pos); + std::string args(msg, pos == std::string::npos ? msg.size() : pos + 1); + + if (type == "help") + { + if (args == "") + { + partyTab->chatLog(_("-- Help --")); + partyTab->chatLog(_("/help > Display this help.")); + partyTab->chatLog(_("/create > Create a new party")); + partyTab->chatLog(_("/new > alias of create")); + partyTab->chatLog(_("/leave > leave the party you are in")); + } + else if (args == "create" || args == "new") + { + partyTab->chatLog(_("Command: /party new ")); + partyTab->chatLog(_("Command: /party create ")); + partyTab->chatLog(_("These commands create a new party chatLog(_("Command: /party leave")); + partyTab->chatLog(_("This command causes the player to leave the party.")); + } + else if (args == "help") + { + partyTab->chatLog(_("Command: /help")); + partyTab->chatLog(_("This command displays a list of all commands available.")); + partyTab->chatLog(_("Command: /help ")); + partyTab->chatLog(_("This command displays help on .")); + } + else + { + partyTab->chatLog(_("Unknown command.")); + partyTab->chatLog(_("Type /help for a list of commands.")); + } + } + else if (type == "create" || type == "new") + { + eAthena::Party::create(args); + } + else if (type == "leave") + { + eAthena::Party::leave(args); + } + else if (type == "settings") + { + partyTab->chatLog(_("The settings command is not yet implemented!")); + /* + MessageOut outMsg(CMSG_PARTY_SETTINGS); + outMsg.writeInt16(0); // Experience + outMsg.writeInt16(0); // Item + */ + } + else + { + partyTab->chatLog("Unknown command"); + } } -- cgit v1.2.3-70-g09d2