From 40f34b7ba7317f5f5c3dfbed0b291be9555d3137 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 28 Jan 2012 00:31:48 +0300 Subject: Add basic support for extended online list on evol server. --- src/net/tmwa/playerhandler.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index d5f0641eb..3d48fb341 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -218,7 +218,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) return; int size = msg.readInt16() - 4; - std::vector arr; + std::vector arr; if (!size) { @@ -230,11 +230,25 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) const char *start = msg.readBytes(size); const char *buf = start; - while (buf - start + 1 < size && *(buf + 1)) + int addVal = 1; + if (serverVersion >= 4) + addVal = 3; + + while (buf - start + 1 < size && *(buf + addVal)) { -// char status = *buf; // now unused + char status = 0; + char ver = 0; + char level = 0; + if (serverVersion >= 4) + { + status = *buf; + buf ++; + level = *buf; + buf ++; + ver = *buf; + } buf ++; - arr.push_back(buf); + arr.push_back(new OnlinePlayer(buf, status, level, ver)); buf += strlen(buf) + 1; } -- cgit v1.2.3-70-g09d2 From a93722a53e2d50466dfd5512c4a6a1c3dfc60fb1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 28 Jan 2012 21:00:12 +0300 Subject: Add support for processing player statuses in evol server. --- src/being.cpp | 37 +++++++++++++++++------------- src/being.h | 6 +++++ src/commandhandler.cpp | 4 ++++ src/game.cpp | 6 +++++ src/gui/shopwindow.cpp | 13 +++++++++++ src/gui/whoisonline.cpp | 36 ++++++++++++++++++++++++++--- src/gui/whoisonline.h | 47 ++++++++++++++++---------------------- src/localplayer.cpp | 23 ++++++++++++++++++- src/localplayer.h | 2 ++ src/net/ea/playerhandler.cpp | 5 ++++ src/net/ea/playerhandler.h | 2 ++ src/net/manaserv/playerhandler.cpp | 5 ++++ src/net/manaserv/playerhandler.h | 2 ++ src/net/playerhandler.h | 2 ++ src/net/tmwa/playerhandler.cpp | 33 +++++++++++++++++++++----- src/net/tmwa/playerhandler.h | 1 + src/net/tmwa/protocol.h | 1 + 17 files changed, 172 insertions(+), 53 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/being.cpp b/src/being.cpp index 39d0bd450..9edfaad7b 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -2517,26 +2517,31 @@ void Being::saveComment(const std::string &name, resman->saveTextFile(dir, "comment.txt", name + "\n" + comment); } +void Being::setState(Uint8 state) +{ + mAdvanced = true; + bool shop = (state & FLAG_SHOP); + bool away = (state & FLAG_AWAY); + bool inactive = (state & FLAG_INACTIVE); + bool needUpdate = (shop != mShop || away != mAway + || inactive != mInactive); + + mShop = shop; + mAway = away; + mInactive = inactive; + + if (needUpdate) + { + updateName(); + addToCache(); + } +} + void Being::setEmote(Uint8 emotion, int emote_time) { if ((emotion & FLAG_SPECIAL) == FLAG_SPECIAL) { - mAdvanced = true; - bool shop = (emotion & FLAG_SHOP); - bool away = (emotion & FLAG_AWAY); - bool inactive = (emotion & FLAG_INACTIVE); - bool needUpdate = (shop != mShop || away != mAway - || inactive != mInactive); - - mShop = shop; - mAway = away; - mInactive = inactive; - - if (needUpdate) - { - updateName(); - addToCache(); - } + setState(emotion); } else { diff --git a/src/being.h b/src/being.h index 6052644c9..f34c192cb 100644 --- a/src/being.h +++ b/src/being.h @@ -102,6 +102,7 @@ class Being : public ActorSprite, public ConfigListener FLAG_SHOP = 1, FLAG_AWAY = 2, FLAG_INACTIVE = 4, + FLAG_GENDER = 128, FLAG_SPECIAL = 128 + 64 }; @@ -546,6 +547,8 @@ class Being : public ActorSprite, public ConfigListener */ void setEmote(Uint8 emotion, int emote_time); + void setState(Uint8 state); + /** * Get the current Emoticon type displayed above * the being. @@ -749,6 +752,9 @@ class Being : public ActorSprite, public ConfigListener bool isShopEnabled() { return mShop; } + void enableShop(bool b) + { mShop = b; } + /** * Sets the attack range. */ diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 0f1e60a25..7a588dc09 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -54,6 +54,7 @@ #include "net/guildhandler.h" #include "net/net.h" #include "net/partyhandler.h" +#include "net/playerhandler.h" #include "net/tradehandler.h" #ifdef DEBUG_DUMP_LEAKS @@ -748,7 +749,10 @@ void CommandHandler::handlePseudoAway(const std::string &args, ChatTab *tab A_UNUSED) { if (player_node) + { player_node->setPseudoAway(args); + player_node->updateStatus(); + } } void CommandHandler::handleFollow(const std::string &args, ChatTab *tab) diff --git a/src/game.cpp b/src/game.cpp index aa9ba1536..e48b37ebc 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -287,6 +287,9 @@ static void createGuiWindows() if (setupWindow) setupWindow->externalUpdate(); + if (player_node) + player_node->updateStatus(); + Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSLOADED)); } @@ -1077,6 +1080,7 @@ bool Game::handleSwitchKeys(SDL_Event &event, bool &used) if (player_node) { player_node->changeAwayMode(); + player_node->updateStatus(); setValidSpeed(); } break; @@ -1585,6 +1589,8 @@ void Game::handleActive(SDL_Event &event) player_node->setHalfAway(true); } } + if (player_node) + player_node->updateStatus(); } if (player_node) player_node->updateName(); diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index b6b87edb7..1a27b8b0c 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -55,6 +55,7 @@ #include "net/net.h" #include "net/chathandler.h" #include "net/npchandler.h" +#include "net/playerhandler.h" #include "net/tradehandler.h" #include "resources/iteminfo.h" @@ -206,11 +207,15 @@ void ShopWindow::action(const gcn::ActionEvent &event) && mBuyShopItemList->getSelected() >= 0) { mBuyShopItems->del(mBuyShopItemList->getSelected()); + if (isShopEmpty() && player_node) + player_node->updateStatus(); } else if (event.getId() == "delete sell" && mSellShopItemList && mSellShopItemList->getSelected() >= 0) { mSellShopItems->del(mSellShopItemList->getSelected()); + if (isShopEmpty() && player_node) + player_node->updateStatus(); } else if (event.getId() == "announce buy" && mBuyShopItems && mBuyShopItems->getNumberOfElements() > 0) @@ -306,8 +311,12 @@ void ShopWindow::addBuyItem(Item *item, int amount, int price) { if (!mBuyShopItems || !item) return; + bool emp = isShopEmpty(); mBuyShopItems->addItemNoDup(item->getId(), item->getColor(), amount, price); + if (emp && player_node) + player_node->updateStatus(); + updateButtonsAndLabels(); } @@ -315,8 +324,12 @@ void ShopWindow::addSellItem(Item *item, int amount, int price) { if (!mBuyShopItems || !item) return; + bool emp = isShopEmpty(); mSellShopItems->addItemNoDup(item->getId(), item->getColor(), amount, price); + if (emp && player_node) + player_node->updateStatus(); + updateButtonsAndLabels(); } diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 34cfc1a57..e38f6ad73 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -402,7 +402,8 @@ void WhoIsOnline::loadWebList() if (!mShowLevel) level = 0; - OnlinePlayer *player = new OnlinePlayer(nick, -1, level, -1); + OnlinePlayer *player = new OnlinePlayer(nick, 0, level, + GENDER_UNSPECIFIED, -1); mOnlinePlayers.insert(player); mOnlineNicks.insert(nick); @@ -709,11 +710,40 @@ void WhoIsOnline::optionChanged(const std::string &name) void OnlinePlayer::setText(std::string color) { - mText = strprintf("@@%s|##%s%s", mNick.c_str(), + mText = strprintf("@@%s|##%s%s ", mNick.c_str(), color.c_str(), mNick.c_str()); + if (actorSpriteManager) + { + Being *being = actorSpriteManager->findBeingByName( + mNick, Being::PLAYER); + if (being) + being->setState(mStatus); + } + if (mLevel > 0) - mText += strprintf(" (%d)", mLevel); + mText += strprintf("%d", mLevel); + + if (mGender == GENDER_FEMALE) + mText += "\u2640"; + else if (mGender == GENDER_MALE) + mText += "\u2642"; + + if (mStatus > 0) + { + if (mStatus & Being::FLAG_SHOP) + mText += "$"; + if (mStatus & Being::FLAG_AWAY) + { + // TRANSLATORS: this away status writed in player nick + mText += _("A"); + } + if (mStatus & Being::FLAG_INACTIVE) + { + // TRANSLATORS: this inactive status writed in player nick + mText += _("I"); + } + } if (mVersion > 0) mText += strprintf(" - %d", mVersion); diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h index ef25257da..feaec3ab4 100644 --- a/src/gui/whoisonline.h +++ b/src/gui/whoisonline.h @@ -45,57 +45,50 @@ struct SDL_Thread; class OnlinePlayer { public: - OnlinePlayer(std::string nick, int status, int level, int version) : + OnlinePlayer(std::string nick, unsigned char status, + unsigned char level, unsigned char gender, + unsigned char version) : mNick(nick), mText(""), mStatus(status), mLevel(level), - mVersion(version) + mVersion(version), + mGender(gender) { } const std::string getNick() const - { - return mNick; - } + { return mNick; } - int getStaus() const - { - return mStatus; - } + unsigned char getStaus() const + { return mStatus; } - int getVersion() const - { - return mVersion; - } + unsigned char getVersion() const + { return mVersion; } - int getLevel() const - { - return mLevel; - } + unsigned char getLevel() const + { return mLevel; } const std::string getText() - { - return mText; - } + { return mText; } void setText(std::string str); - void setLevel(int level) - { - mLevel = level; - } + void setLevel(unsigned char level) + { mLevel = level; } private: std::string mNick; std::string mText; - int mStatus; + unsigned char mStatus; + + unsigned char mLevel; - int mLevel; + unsigned char mVersion; - int mVersion; + unsigned char mGender; }; /** diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 3df4a3214..bd69d785f 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -354,7 +354,8 @@ void LocalPlayer::logic() } } - if (mEnableAdvert && !mBlockAdvert && mAdvertTime < cur_time) + if (serverVersion < 4 && mEnableAdvert && !mBlockAdvert + && mAdvertTime < cur_time) { Uint8 smile = FLAG_SPECIAL; if (mTradebot && shopWindow && !shopWindow->isShopEmpty()) @@ -3442,6 +3443,7 @@ void LocalPlayer::setAway(const std::string &message) if (!message.empty()) config.setValue("afkMessage", message); changeAwayMode(); + updateStatus(); } void LocalPlayer::setPseudoAway(const std::string &message) @@ -4207,11 +4209,30 @@ const char *LocalPlayer::getVarItem(const char **arr, unsigned index, return arr[sz]; } +void LocalPlayer::updateStatus() +{ + if (serverVersion >= 4 && mEnableAdvert) + { + Uint8 status = 0; + if (mTradebot && shopWindow && !shopWindow->isShopEmpty()) + status += FLAG_SHOP; + + if (mAwayMode || mPseudoAwayMode) + status += FLAG_AWAY; + + if (mInactive) + status += FLAG_INACTIVE; + + Net::getPlayerHandler()->updateStatus(status); + } +} + void AwayListener::action(const gcn::ActionEvent &event) { if (event.getId() == "ok" && player_node && player_node->getAway()) { player_node->changeAwayMode(); + player_node->updateStatus(); if (outfitWindow) outfitWindow->unwearAwayOutfit(); if (miniStatusWindow) diff --git a/src/localplayer.h b/src/localplayer.h index ed181e3d0..ede073abf 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -477,6 +477,8 @@ class LocalPlayer : public Being, public ActorSpriteListener, bool checAttackPermissions(Being *target); + void updateStatus(); + std::string getInvertDirectionString(); std::string getCrazyMoveTypeString(); diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 6a841415f..90c635428 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -645,4 +645,9 @@ int PlayerHandler::getAttackLocation() const { return EA_ATK; } + +void PlayerHandler::updateStatus() +{ + +} } // namespace Ea diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index d0402ecfc..7bf569349 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -68,6 +68,8 @@ class PlayerHandler : public Net::PlayerHandler void processPlayerStatUpdate6(Net::MessageIn &msg); void processPlayerArrowMessage(Net::MessageIn &msg); + + void updateStatus(); }; } // namespace Ea diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index 5ebf840bc..aa79d4d41 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -448,4 +448,9 @@ void PlayerHandler::requestOnlineList() } +void PlayerHandler::updateStatus(Uint8 status) +{ + +} + } // namespace ManaServ diff --git a/src/net/manaserv/playerhandler.h b/src/net/manaserv/playerhandler.h index 0255406a8..23d2f5e32 100644 --- a/src/net/manaserv/playerhandler.h +++ b/src/net/manaserv/playerhandler.h @@ -74,6 +74,8 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler Vector getDefaultWalkSpeed() const; + void updateStatus(Uint8 status); + private: void handleMapChangeMessage(Net::MessageIn &msg); }; diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index f62acc0c9..6ae912102 100644 --- a/src/net/playerhandler.h +++ b/src/net/playerhandler.h @@ -73,6 +73,8 @@ class PlayerHandler virtual Vector getDefaultWalkSpeed() const = 0; virtual void requestOnlineList() = 0; + + virtual void updateStatus(Uint8 status) = 0; }; } // namespace Net diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 3d48fb341..621a747b0 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -22,6 +22,7 @@ #include "net/tmwa/playerhandler.h" +#include "configuration.h" #include "logger.h" #include "net/messagein.h" @@ -227,8 +228,8 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) return; } - const char *start = msg.readBytes(size); - const char *buf = start; + char *start = (char*)msg.readBytes(size); + char *buf = start; int addVal = 1; if (serverVersion >= 4) @@ -236,9 +237,9 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) while (buf - start + 1 < size && *(buf + addVal)) { - char status = 0; - char ver = 0; - char level = 0; + unsigned char status = 0; + unsigned char ver = 0; + unsigned char level = 0; if (serverVersion >= 4) { status = *buf; @@ -248,7 +249,20 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) ver = *buf; } buf ++; - arr.push_back(new OnlinePlayer(buf, status, level, ver)); + + int gender = GENDER_UNSPECIFIED; + if (serverVersion >= 4) + { + if (config.getBoolValue("showgender")) + { + if (status & Being::FLAG_GENDER) + gender = GENDER_MALE; + else + gender = GENDER_FEMALE; + } + } + arr.push_back(new OnlinePlayer((char*)buf, + status, level, gender, ver)); buf += strlen(buf) + 1; } @@ -257,4 +271,11 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) delete [] start; } +void PlayerHandler::updateStatus(Uint8 status) +{ + MessageOut outMsg(CMSG_SET_STATUS); + outMsg.writeInt8(status); + outMsg.writeInt8(0); +} + } // namespace TmwAthena diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h index 0fa524d51..14aa191f6 100644 --- a/src/net/tmwa/playerhandler.h +++ b/src/net/tmwa/playerhandler.h @@ -53,6 +53,7 @@ class PlayerHandler : public MessageHandler, public Ea::PlayerHandler void changeAction(Being::Action action); void processOnlineList(Net::MessageIn &msg); void requestOnlineList(); + void updateStatus(Uint8 status); void respawn(); }; diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h index ddc642101..256f1dce4 100644 --- a/src/net/tmwa/protocol.h +++ b/src/net/tmwa/protocol.h @@ -336,5 +336,6 @@ enum #define CMSG_ONLINE_LIST 0x0210 #define SMSG_ONLINE_LIST 0x0211 #define SMSG_NPC_COMMAND 0x0212 +#define CMSG_SET_STATUS 0x0213 #endif -- cgit v1.2.3-70-g09d2 From e18e3bdf005824b5875bda74053c116b6c4c059f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 29 Jan 2012 15:41:25 +0300 Subject: Fix possible hiding methods issues. --- src/gui/inventorywindow.cpp | 6 +++--- src/gui/itemamountwindow.cpp | 10 ++++------ src/gui/popupmenu.cpp | 12 ++++++------ src/gui/statuswindow.cpp | 4 ++-- src/gui/widgets/setupitem.cpp | 10 +++++----- src/gui/widgets/vertcontainer.cpp | 6 +++--- src/gui/widgets/vertcontainer.h | 4 ++-- src/net/adminhandler.h | 6 +++--- src/net/ea/adminhandler.cpp | 6 +++--- src/net/ea/adminhandler.h | 6 +++--- src/net/ea/playerhandler.cpp | 4 ---- src/net/ea/playerhandler.h | 2 -- src/net/inventoryhandler.h | 2 +- src/net/manaserv/adminhandler.cpp | 6 +++--- src/net/manaserv/adminhandler.h | 6 +++--- src/net/manaserv/specialhandler.cpp | 10 +++++----- src/net/manaserv/specialhandler.h | 6 +++--- src/net/specialhandler.h | 6 +++--- src/net/tmwa/inventoryhandler.cpp | 4 ++-- src/net/tmwa/inventoryhandler.h | 2 +- src/net/tmwa/specialhandler.cpp | 6 +++--- src/net/tmwa/specialhandler.h | 6 +++--- 22 files changed, 61 insertions(+), 69 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 01e2bdd17..4a54f5fb2 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -340,7 +340,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event) { if (isStorageActive()) { - Net::getInventoryHandler()->moveItem(Inventory::INVENTORY, + Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, item->getInvIndex(), item->getQuantity(), Inventory::STORAGE); } @@ -431,7 +431,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) } else { - Net::getInventoryHandler()->moveItem(Inventory::INVENTORY, + Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, item->getInvIndex(), item->getQuantity(), Inventory::STORAGE); } @@ -445,7 +445,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) } else { - Net::getInventoryHandler()->moveItem(Inventory::STORAGE, + Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, item->getInvIndex(), item->getQuantity(), Inventory::INVENTORY); } diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp index 9e2a97681..3b01b559f 100644 --- a/src/gui/itemamountwindow.cpp +++ b/src/gui/itemamountwindow.cpp @@ -113,14 +113,12 @@ void ItemAmountWindow::finish(Item *item, int amount, int price, Usage usage) Net::getInventoryHandler()->splitItem(item, amount); break; case StoreAdd: - Net::getInventoryHandler()->moveItem(Inventory::INVENTORY, - item->getInvIndex(), amount, - Inventory::STORAGE); + Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, + item->getInvIndex(), amount, Inventory::STORAGE); break; case StoreRemove: - Net::getInventoryHandler()->moveItem(Inventory::STORAGE, - item->getInvIndex(), amount, - Inventory::INVENTORY); + Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, + item->getInvIndex(), amount, Inventory::INVENTORY); break; case ShopBuyAdd: if (shopWindow) diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index cd3a4c5ad..142acc69c 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -1184,19 +1184,19 @@ void PopupMenu::handleLink(const std::string &link, int cnt = 10; if (cnt > mItem->getQuantity()) cnt = mItem->getQuantity(); - Net::getInventoryHandler()->moveItem(Inventory::INVENTORY, + Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, mItem->getInvIndex(), cnt, Inventory::STORAGE); } else if (link == "store half" && mItem) { - Net::getInventoryHandler()->moveItem(Inventory::INVENTORY, + Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, mItem->getInvIndex(), mItem->getQuantity() / 2, Inventory::STORAGE); } else if (link == "store all" && mItem) { - Net::getInventoryHandler()->moveItem(Inventory::INVENTORY, + Net::getInventoryHandler()->moveItem2(Inventory::INVENTORY, mItem->getInvIndex(), mItem->getQuantity(), Inventory::STORAGE); } @@ -1235,19 +1235,19 @@ void PopupMenu::handleLink(const std::string &link, int cnt = 10; if (cnt > mItem->getQuantity()) cnt = mItem->getQuantity(); - Net::getInventoryHandler()->moveItem(Inventory::STORAGE, + Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, mItem->getInvIndex(), cnt, Inventory::INVENTORY); } else if (link == "retrieve half" && mItem) { - Net::getInventoryHandler()->moveItem(Inventory::STORAGE, + Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, mItem->getInvIndex(), mItem->getQuantity() / 2, Inventory::INVENTORY); } else if (link == "retrieve all" && mItem) { - Net::getInventoryHandler()->moveItem(Inventory::STORAGE, + Net::getInventoryHandler()->moveItem2(Inventory::STORAGE, mItem->getInvIndex(), mItem->getQuantity(), Inventory::INVENTORY); } diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index a5fd12d40..57c81bc04 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -424,12 +424,12 @@ void StatusWindow::addAttribute(int id, const std::string &name, if (modifiable) { disp = new ChangeDisplay(id, name); - mAttrCont->add(disp); + mAttrCont->add1(disp); } else { disp = new DerDisplay(id, name); - mDAttrCont->add(disp); + mDAttrCont->add1(disp); } mAttrs[id] = disp; } diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 92ff625c2..059b05ba2 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -192,7 +192,7 @@ void SetupItemCheckBox::createControls() load(); mCheckBox = new CheckBox(mText, mValue != "0", mParent, mEventName); mWidget = mCheckBox; - mParent->getContainer()->add(mWidget); + mParent->getContainer()->add1(mWidget); mParent->addControl(this); mParent->addActionListener(this); mWidget->addActionListener(this); @@ -275,7 +275,7 @@ void SetupItemTextField::createControls() mHorizont->add(mTextField); mHorizont->add(mButton); - mParent->getContainer()->add(mHorizont, true, 4); + mParent->getContainer()->add2(mHorizont, true, 4); mParent->addControl(this); mParent->addControl(this, mEventName + "_EDIT"); mParent->addControl(this, mEventName + "_EDIT_OK"); @@ -398,7 +398,7 @@ void SetupItemIntTextField::createControls() mHorizont->add(mTextField); mHorizont->add(mButton); - mParent->getContainer()->add(mHorizont, true, 4); + mParent->getContainer()->add2(mHorizont, true, 4); mParent->addControl(this); mParent->addControl(this, mEventName + "_EDIT"); mParent->addControl(this, mEventName + "_EDIT_OK"); @@ -486,7 +486,7 @@ void SetupItemLabel::createControls() } mWidget = mLabel; - mParent->getContainer()->add(mWidget); + mParent->getContainer()->add1(mWidget); mParent->addControl(this); mParent->addActionListener(this); mWidget->addActionListener(this); @@ -568,7 +568,7 @@ void SetupItemDropDown::createControls() mHorizont->add(mLabel); mHorizont->add(mDropDown); - mParent->getContainer()->add(mHorizont, true, 4); + mParent->getContainer()->add2(mHorizont, true, 4); mParent->addControl(this); mParent->addActionListener(this); mWidget->addActionListener(this); diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index 42ae97802..0eb59c8f9 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -35,12 +35,12 @@ VertContainer::VertContainer(int verticalItemSize, bool resizable, addWidgetListener(this); } -void VertContainer::add(gcn::Widget *widget, int spacing) +void VertContainer::add1(gcn::Widget *widget, int spacing) { - add(widget, mResizable, spacing); + add2(widget, mResizable, spacing); } -void VertContainer::add(gcn::Widget *widget, bool resizable, int spacing) +void VertContainer::add2(gcn::Widget *widget, bool resizable, int spacing) { if (!widget) return; diff --git a/src/gui/widgets/vertcontainer.h b/src/gui/widgets/vertcontainer.h index 6e1305a06..9460c837e 100644 --- a/src/gui/widgets/vertcontainer.h +++ b/src/gui/widgets/vertcontainer.h @@ -39,10 +39,10 @@ class VertContainer : public Container, public gcn::WidgetListener VertContainer(int verticalItemSize, bool resizable = true, int leftSpacing = 0); - virtual void add(gcn::Widget *widget, bool resizable, + virtual void add2(gcn::Widget *widget, bool resizable, int spacing = -1); - virtual void add(gcn::Widget *widget, int spacing = -1); + virtual void add1(gcn::Widget *widget, int spacing = -1); virtual void clear(); diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index f6d8606ce..2ac462834 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -42,15 +42,15 @@ class AdminHandler virtual void kick(int playerId) = 0; - virtual void kick(const std::string &name) = 0; + virtual void kickName(const std::string &name) = 0; virtual void ban(int playerId) = 0; - virtual void ban(const std::string &name) = 0; + virtual void banName(const std::string &name) = 0; virtual void unban(int playerId) = 0; - virtual void unban(const std::string &name) = 0; + virtual void unbanName(const std::string &name) = 0; virtual void mute(int playerId, int type, int limit) = 0; diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp index 556629458..f70be3cc8 100644 --- a/src/net/ea/adminhandler.cpp +++ b/src/net/ea/adminhandler.cpp @@ -32,7 +32,7 @@ namespace Ea { -void AdminHandler::kick(const std::string &name) +void AdminHandler::kickName(const std::string &name) { Net::getChatHandler()->talk("@kick " + name); } @@ -42,7 +42,7 @@ void AdminHandler::ban(int playerId A_UNUSED) // Not supported } -void AdminHandler::ban(const std::string &name) +void AdminHandler::banName(const std::string &name) { Net::getChatHandler()->talk("@ban " + name); } @@ -52,7 +52,7 @@ void AdminHandler::unban(int playerId A_UNUSED) // Not supported } -void AdminHandler::unban(const std::string &name) +void AdminHandler::unbanName(const std::string &name) { Net::getChatHandler()->talk("@unban " + name); } diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h index 70c458514..5b5224174 100644 --- a/src/net/ea/adminhandler.h +++ b/src/net/ea/adminhandler.h @@ -35,15 +35,15 @@ class AdminHandler : public Net::AdminHandler virtual ~AdminHandler() { } - virtual void kick(const std::string &name); + virtual void kickName(const std::string &name); virtual void ban(int playerId); - virtual void ban(const std::string &name); + virtual void banName(const std::string &name); virtual void unban(int playerId); - virtual void unban(const std::string &name); + virtual void unbanName(const std::string &name); virtual void mute(int playerId, int type, int limit); diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 90c635428..76a7b0dbc 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -646,8 +646,4 @@ int PlayerHandler::getAttackLocation() const return EA_ATK; } -void PlayerHandler::updateStatus() -{ - -} } // namespace Ea diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index 7bf569349..d0402ecfc 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -68,8 +68,6 @@ class PlayerHandler : public Net::PlayerHandler void processPlayerStatUpdate6(Net::MessageIn &msg); void processPlayerArrowMessage(Net::MessageIn &msg); - - void updateStatus(); }; } // namespace Ea diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h index ec2f3db47..45f7c3028 100644 --- a/src/net/inventoryhandler.h +++ b/src/net/inventoryhandler.h @@ -57,7 +57,7 @@ class InventoryHandler //void changeCart() = 0; - virtual void moveItem(int source, int slot, int amount, + virtual void moveItem2(int source, int slot, int amount, int destination) = 0; // TODO: fix/remove me diff --git a/src/net/manaserv/adminhandler.cpp b/src/net/manaserv/adminhandler.cpp index 609c9e4f1..f44da97ff 100644 --- a/src/net/manaserv/adminhandler.cpp +++ b/src/net/manaserv/adminhandler.cpp @@ -62,7 +62,7 @@ void AdminHandler::kick(int playerId A_UNUSED) // TODO } -void AdminHandler::kick(const std::string &name A_UNUSED) +void AdminHandler::kickName(const std::string &name A_UNUSED) { // TODO } @@ -72,7 +72,7 @@ void AdminHandler::ban(int playerId A_UNUSED) // TODO } -void AdminHandler::ban(const std::string &name A_UNUSED) +void AdminHandler::banName(const std::string &name A_UNUSED) { // TODO } @@ -82,7 +82,7 @@ void AdminHandler::unban(int playerId A_UNUSED) // TODO } -void AdminHandler::unban(const std::string &name A_UNUSED) +void AdminHandler::unbanName(const std::string &name A_UNUSED) { // TODO } diff --git a/src/net/manaserv/adminhandler.h b/src/net/manaserv/adminhandler.h index a4157b3b0..87c536c31 100644 --- a/src/net/manaserv/adminhandler.h +++ b/src/net/manaserv/adminhandler.h @@ -42,15 +42,15 @@ class AdminHandler : public Net::AdminHandler void kick(int playerId); - void kick(const std::string &name); + void kickName(const std::string &name); void ban(int playerId); - void ban(const std::string &name); + void banName(const std::string &name); void unban(int playerId); - void unban(const std::string &name); + void unbanName(const std::string &name); void mute(int playerId, int type, int limit); diff --git a/src/net/manaserv/specialhandler.cpp b/src/net/manaserv/specialhandler.cpp index 13c6f7613..73fa864a3 100644 --- a/src/net/manaserv/specialhandler.cpp +++ b/src/net/manaserv/specialhandler.cpp @@ -53,19 +53,19 @@ void SpecialHandler::use(int id) gameServerConnection->send(msg); } -void SpecialHandler::use(int id A_UNUSED, int level A_UNUSED, - int beingId A_UNUSED) +void SpecialHandler::useBeing(int id A_UNUSED, int level A_UNUSED, + int beingId A_UNUSED) { // TODO } -void SpecialHandler::use(int id A_UNUSED, int level A_UNUSED, int x A_UNUSED, - int y A_UNUSED) +void SpecialHandler::usePos(int id A_UNUSED, int level A_UNUSED, int x A_UNUSED, + int y A_UNUSED) { // TODO } -void SpecialHandler::use(int id A_UNUSED, const std::string &map A_UNUSED) +void SpecialHandler::useMap(int id A_UNUSED, const std::string &map A_UNUSED) { // TODO } diff --git a/src/net/manaserv/specialhandler.h b/src/net/manaserv/specialhandler.h index f6a20e4ac..2f1ce4d07 100644 --- a/src/net/manaserv/specialhandler.h +++ b/src/net/manaserv/specialhandler.h @@ -39,11 +39,11 @@ class SpecialHandler : public MessageHandler, public Net::SpecialHandler void use(int id); - void use(int id, int level, int beingId); + void useBeing(int id, int level, int beingId); - void use(int id, int level, int x, int y); + void usePos(int id, int level, int x, int y); - void use(int id, const std::string &map); + void useMap(int id, const std::string &map); }; } // namespace ManaServ diff --git a/src/net/specialhandler.h b/src/net/specialhandler.h index 7ed3673cf..f385f47f9 100644 --- a/src/net/specialhandler.h +++ b/src/net/specialhandler.h @@ -35,11 +35,11 @@ class SpecialHandler virtual void use(int id) = 0; - virtual void use(int id, int level, int beingId) = 0; + virtual void useBeing(int id, int level, int beingId) = 0; - virtual void use(int id, int level, int x, int y) = 0; + virtual void usePos(int id, int level, int x, int y) = 0; - virtual void use(int id, const std::string &map) = 0; + virtual void useMap(int id, const std::string &map) = 0; }; } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 7fa26f5ed..db670a17b 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -186,8 +186,8 @@ void InventoryHandler::closeStorage(int type A_UNUSED) MessageOut outMsg(CMSG_CLOSE_STORAGE); } -void InventoryHandler::moveItem(int source, int slot, int amount, - int destination) +void InventoryHandler::moveItem2(int source, int slot, int amount, + int destination) { if (source == Inventory::INVENTORY && destination == Inventory::STORAGE) { diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index d2ecc4b6d..c6e000b3a 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -53,7 +53,7 @@ class InventoryHandler : public MessageHandler, public Ea::InventoryHandler void closeStorage(int type); - void moveItem(int source, int slot, int amount, int destination); + void moveItem2(int source, int slot, int amount, int destination); }; } // namespace TmwAthena diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp index 9fa7b6dfa..129f0b47e 100644 --- a/src/net/tmwa/specialhandler.cpp +++ b/src/net/tmwa/specialhandler.cpp @@ -69,7 +69,7 @@ void SpecialHandler::handleMessage(Net::MessageIn &msg) } } -void SpecialHandler::use(int id, int level, int beingId) +void SpecialHandler::useBeing(int id, int level, int beingId) { MessageOut outMsg(CMSG_SKILL_USE_BEING); outMsg.writeInt16(static_cast(level)); @@ -77,7 +77,7 @@ void SpecialHandler::use(int id, int level, int beingId) outMsg.writeInt16(static_cast(beingId)); } -void SpecialHandler::use(int id, int level, int x, int y) +void SpecialHandler::usePos(int id, int level, int x, int y) { MessageOut outMsg(CMSG_SKILL_USE_POSITION); outMsg.writeInt16(static_cast(level)); @@ -86,7 +86,7 @@ void SpecialHandler::use(int id, int level, int x, int y) outMsg.writeInt16(static_cast(y)); } -void SpecialHandler::use(int id, const std::string &map) +void SpecialHandler::useMap(int id, const std::string &map) { MessageOut outMsg(CMSG_SKILL_USE_MAP); outMsg.writeInt16(static_cast(id)); diff --git a/src/net/tmwa/specialhandler.h b/src/net/tmwa/specialhandler.h index f17ef4c44..216adddc6 100644 --- a/src/net/tmwa/specialhandler.h +++ b/src/net/tmwa/specialhandler.h @@ -40,11 +40,11 @@ class SpecialHandler : public MessageHandler, public Ea::SpecialHandler void handleMessage(Net::MessageIn &msg); - void use(int id, int level, int beingId); + void useBeing(int id, int level, int beingId); - void use(int id, int level, int x, int y); + void usePos(int id, int level, int x, int y); - void use(int id, const std::string &map); + void useMap(int id, const std::string &map); }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2 From dccd82a3a841e741c59a6db423e9ec1fc471baad Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 29 Jan 2012 21:46:57 +0300 Subject: Fix client detection in online list. And online list typo. --- src/gui/whoisonline.cpp | 8 ++++---- src/net/tmwa/playerhandler.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 5dff3d503..7965221e4 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -282,7 +282,7 @@ void WhoIsOnline::loadList(std::vector &list) case PlayerRelation::FRIEND: player->setText("2"); - neutral.push_back(player); + friends.push_back(player); break; case PlayerRelation::DISREGARDED: @@ -409,7 +409,7 @@ void WhoIsOnline::loadWebList() if (!mShowLevel) level = 0; - OnlinePlayer *player = new OnlinePlayer(nick, 0, level, + OnlinePlayer *player = new OnlinePlayer(nick, 255, level, GENDER_UNSPECIFIED, -1); mOnlinePlayers.insert(player); mOnlineNicks.insert(nick); @@ -720,7 +720,7 @@ void OnlinePlayer::setText(std::string color) mText = strprintf("@@%s|##%s%s ", mNick.c_str(), color.c_str(), mNick.c_str()); - if (actorSpriteManager) + if (mStatus != 255 && actorSpriteManager) { Being *being = actorSpriteManager->findBeingByName( mNick, Being::PLAYER); @@ -736,7 +736,7 @@ void OnlinePlayer::setText(std::string color) else if (mGender == GENDER_MALE) mText += "\u2642"; - if (mStatus > 0) + if (mStatus > 0 && mStatus != 255) { if (mStatus & Being::FLAG_SHOP) mText += "$"; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 621a747b0..8747cf9c4 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -237,7 +237,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) while (buf - start + 1 < size && *(buf + addVal)) { - unsigned char status = 0; + unsigned char status = 255; unsigned char ver = 0; unsigned char level = 0; if (serverVersion >= 4) -- cgit v1.2.3-70-g09d2 From 193ea898e5f549c14c0e4cd0d060785de4fb4bcf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 29 Jan 2012 23:59:16 +0300 Subject: Fix player mobing message type 2 processing. --- src/net/tmwa/beinghandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 627db1402..8d279fc32 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -590,7 +590,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) if (gmstatus & 0x80) dstBeing->setGM(true); - if (msgType == 1) + if (msgType == 1 || msgType == 2) { int type = msg.readInt8(); switch (type) -- cgit v1.2.3-70-g09d2