diff options
-rw-r--r-- | INSTALL | 12 | ||||
-rw-r--r-- | NEWS | 58 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | data/graphics/gui/item_shortcut_bgr.png | bin | 929 -> 284 bytes | |||
-rw-r--r-- | data/help/changes.txt | 44 | ||||
-rw-r--r-- | data/help/header.txt | 2 | ||||
-rw-r--r-- | src/game.cpp | 24 | ||||
-rw-r--r-- | src/gui/chat.cpp | 8 | ||||
-rw-r--r-- | src/gui/itemcontainer.cpp | 31 | ||||
-rw-r--r-- | src/gui/itemcontainer.h | 13 | ||||
-rw-r--r-- | src/gui/npcdialog.cpp | 19 | ||||
-rw-r--r-- | src/gui/npcdialog.h | 2 | ||||
-rw-r--r-- | src/gui/partywindow.cpp | 7 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 26 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/avatar.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 7 | ||||
-rw-r--r-- | src/keyboardconfig.cpp | 1 | ||||
-rw-r--r-- | src/keyboardconfig.h | 1 | ||||
-rw-r--r-- | src/localplayer.cpp | 19 | ||||
-rw-r--r-- | src/localplayer.h | 6 | ||||
-rw-r--r-- | src/net/ea/beinghandler.cpp | 16 | ||||
-rw-r--r-- | src/net/ea/partyhandler.cpp | 3 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 1 | ||||
-rw-r--r-- | src/player.cpp | 60 | ||||
-rw-r--r-- | src/player.h | 2 |
27 files changed, 271 insertions, 114 deletions
@@ -24,7 +24,7 @@ and some libraries. The required libraries are: * ENet 1.2 http://enet.bespin.org/ * Guichan 0.8.x http://guichan.sourceforge.net/ * libxml2 http://www.xmlsoft.org/ -* physfs 1.0.x http://icculus.org/physfs/ +* physfs 1.x http://icculus.org/physfs/ * zlib 1.2.x http://www.gzip.org/zlib/ * libcurl http://curl.haxx.se/libcurl/ @@ -67,6 +67,16 @@ different prefix to configure as usual. Rebuild the executable from scratch using "make clean" and then "make". + NOTE: This version of TMW can be compiled with support for connecting to + tmwserv, a server developed from scratch by the TMW project. However, the + client won't support eAthena anymore when you do. In future clients we + intend to support either server from a single compile. + + To configure the client with support for tmwserv, do step 3 as follows: + + ./configure --with-server=tmwserv + + 3. Notes ======== @@ -1,18 +1,46 @@ -0.0.29 (...) -* Added ability to record the chatlog to a file -* Added support for dynamic emotes -* Added speech balloons that wrap the text -* Added item popup for showing detailed information -* Added support for external tilesets -* Added ability to refer to items in chat -* Added the ability to see your own name in game -* Made smily shortcuts customizable in more detail -* Made chat colors customizable -* Made it possible to change resolution -* GUI opacity now effects more widgets -* Redesigned equipment window and allow unequip from there -* Next level percentage is now displayed in hundredths -* Player and NPC names now appear in bold for better readability +0.0.29 (13 May 2009) +- Added support for dynamic emotes and a new way to select them +- Added speech balloons that wrap the text +- Added item popup for showing detailed information +- Added ability to refer to items in chat +- Added the ability to see your own name in game +- Added the option to hide player names +- Added support for dynamically defined weight unit and currency +- Added support for NPC item storage +- Added compile-time support for tmwserv, as an alternative to eAthena +- Added support for entering the port of the login server +- Added support for creating parties and inviting other players to them +- Added tabs to the chat window for party and private chats +- Added ability to set initial player attributes when creating a new character +- Added command line option to temporarily disable OpenGL (--no-opengl) +- Added support for showing arrows flying through the air +- Added option to show pickup as text particle instead of in the chat +- Added ability to change the font size +- Added support for the /me command to do actions +- Added a /present command to show players present in the area +- Added ability to record the chatlog to a file +- Made emote shortcuts customizable in more detail +- Made it possible to change resolution +- Made many colors used by the game configurable +- Made setup window available during login +- Dynamically generate the item effects description +- Minimap can now be told to stay on the screen +- Minimap now adapts to the scale and size of the minimap image +- Non-stackable items can now be sold more easily +- Login dialog now remembers the list of recently used servers +- Completely rewritten NPC interaction +- GUI opacity now effects the whole user interface +- Redesigned the trade window +- Redesigned equipment window and allow unequip from there +- Next level percentage is now displayed in hundredths +- The player will no longer walk away when clicking the map while sitting +- Keep the login screen from taking 100% CPU +- No longer prompt for character server when there is only one +- Fixed compilation with GCC 4.4 +- Fixed scroll wheel handling and dragging glitches in lists +- Many more bug fixes, small improvements and code cleanups +- Updated German, Finnish, Croatian, French, Spanish, Swedish and Polish + translations 0.0.28.1 (12 February 2009) - Enabled translations on Windows @@ -1,7 +1,7 @@ THE MANA WORLD ============== - Version: 0.0.29 Date: XX/XX/2009 + Version: 0.0.29 Date: 13/05/2009 Development team: - See AUTHORS file for a list @@ -12,6 +12,7 @@ THE MANA WORLD - Guichan (GUI framework) - libxml2 (XML parsing and writing) - PhysFS (Data files) + - ENet (UDP networking library) - libcurl (HTTP downloads) - zlib (Archives) diff --git a/data/graphics/gui/item_shortcut_bgr.png b/data/graphics/gui/item_shortcut_bgr.png Binary files differindex 57b90141..0543e38a 100644 --- a/data/graphics/gui/item_shortcut_bgr.png +++ b/data/graphics/gui/item_shortcut_bgr.png diff --git a/data/help/changes.txt b/data/help/changes.txt index 50242b50..840bd691 100644 --- a/data/help/changes.txt +++ b/data/help/changes.txt @@ -3,6 +3,50 @@ ##3 === RECENT CHANGES === + 0.0.29 (13 May 2009) + - Added support for dynamic emotes and a new way to select them + - Added speech balloons that wrap the text + - Added item popup for showing detailed information + - Added ability to refer to items in chat + - Added the ability to see your own name in game + - Added the option to hide player names + - Added support for dynamically defined weight unit and currency + - Added support for NPC item storage + - Added compile-time support for tmwserv, as an alternative to eAthena + - Added support for entering the port of the login server + - Added support for creating parties and inviting other players to them + - Added tabs to the chat window for party and private chats + - Added ability to set initial player attributes when creating a new character + - Added command line option to temporarily disable OpenGL (--no-opengl) + - Added support for showing arrows flying through the air + - Added option to show pickup as text particle instead of in the chat + - Added ability to change the font size + - Added support for the /me command to do actions + - Added a /present command to show players present in the area + - Added ability to record the chatlog to a file + - Made emote shortcuts customizable in more detail + - Made it possible to change resolution + - Made many colors used by the game configurable + - Made setup window available during login + - Dynamically generate the item effects description + - Minimap can now be told to stay on the screen + - Minimap now adapts to the scale and size of the minimap image + - Non-stackable items can now be sold more easily + - Login dialog now remembers the list of recently used servers + - Completely rewritten NPC interaction + - GUI opacity now effects the whole user interface + - Redesigned the trade window + - Redesigned equipment window and allow unequip from there + - Next level percentage is now displayed in hundredths + - The player will no longer walk away when clicking the map while sitting + - Keep the login screen from taking 100% CPU + - No longer prompt for character server when there is only one + - Fixed compilation with GCC 4.4 + - Fixed scroll wheel handling and dragging glitches in lists + - Many more bug fixes, small improvements and code cleanups + - Updated German, Finnish, Croatian, French, Spanish, Swedish and Polish + translations + 0.0.28.1 (12 February 2009) - Enabled translations on Windows - Added command line option to set home directory path diff --git a/data/help/header.txt b/data/help/header.txt index 0309b970..d7e8e6e5 100644 --- a/data/help/header.txt +++ b/data/help/header.txt @@ -2,7 +2,7 @@ ##1 T H E M A N A W O R L D ##1 ========================================== - ##2Version:##6 0.0.29 ##2Date:##3 [Day] [Month] 2009 + ##2Version:##6 0.0.29 ##2Date:##3 13 May 2009 ##2 Website: http://themanaworld.org diff --git a/src/game.cpp b/src/game.cpp index b56cbdde..59c57607 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -582,6 +582,13 @@ void Game::handleInput() if (chatWindow->requestChatFocus()) used = true; } + if (npcDialog->isVisible()) + { + if (keyboard.isKeyActive(keyboard.KEY_MOVE_UP)) + npcDialog->move(1); + else if (keyboard.isKeyActive(keyboard.KEY_MOVE_DOWN)) + npcDialog->move(-1); + } } @@ -923,6 +930,23 @@ void Game::handleInput() if (player_node->getTarget()) player_node->attack(player_node->getTarget(), true); } + + if (keyboard.isKeyActive(keyboard.KEY_TARGET_ATTACK)) + { + Being *target = NULL; + + bool newTarget = !keyboard.isKeyActive(keyboard.KEY_TARGET); + // A set target has highest priority + if (!player_node->getTarget()) + { + Uint16 targetX = x, targetY = y; + // Only auto target Monsters + target = beingManager->findNearestLivingBeing(targetX, targetY, + 20, Being::MONSTER); + } + player_node->attack(target, newTarget); + } + #endif // Target the nearest player/monster/npc diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index eca224fc..414d1e02 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -105,14 +105,6 @@ ChatWindow::ChatWindow(): mReturnToggles = config.getValue("ReturnToggles", "0") == "1"; -#ifdef EATHENA_SUPPORT - // If the player had @assert on in the last session, ask the server to - // run the @assert command for the player again. Convenience for GMs. - if (config.getValue(player_node->getName() + "GMassert", 0)) { - std::string cmd = "@assert"; - chatInput(cmd); - } -#endif mRecorder = new Recorder(this); } diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 6cbdabb2..54aa818b 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -57,6 +57,7 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity): mGridRows(1), mSelectedIndex(-1), mHighlightedIndex(-1), + mLastUsedSlot(-1), mSelectionStatus(SEL_NONE), mForceQuantity(forceQuantity), mSwapItems(false), @@ -82,6 +83,19 @@ ItemContainer::~ItemContainer() delete mItemPopup; } +void ItemContainer::logic() +{ + gcn::Widget::logic(); + + const int lastUsedSlot = mInventory->getLastUsedSlot(); + + if (lastUsedSlot != mLastUsedSlot) + { + mLastUsedSlot = lastUsedSlot; + adjustHeight(); + } +} + void ItemContainer::draw(gcn::Graphics *graphics) { Graphics *g = static_cast<Graphics*>(graphics); @@ -178,7 +192,7 @@ void ItemContainer::distributeValueChangedEvent() void ItemContainer::keyPressed(gcn::KeyEvent &event) { - switch (event.getKey().getValue()) + /*switch (event.getKey().getValue()) { case Key::LEFT: moveHighlight(Left); @@ -202,12 +216,12 @@ void ItemContainer::keyPressed(gcn::KeyEvent &event) case Key::RIGHT_CONTROL: mDescItems = true; break; - } + }*/ } void ItemContainer::keyReleased(gcn::KeyEvent &event) { - switch (event.getKey().getValue()) + /*switch (event.getKey().getValue()) { case Key::LEFT_ALT: case Key::RIGHT_ALT: @@ -216,7 +230,7 @@ void ItemContainer::keyReleased(gcn::KeyEvent &event) case Key::RIGHT_CONTROL: mDescItems = false; break; - } + }*/ } void ItemContainer::mousePressed(gcn::MouseEvent &event) @@ -316,8 +330,13 @@ void ItemContainer::mouseExited(gcn::MouseEvent &event) void ItemContainer::widgetResized(const gcn::Event &event) { mGridColumns = std::max(1, getWidth() / BOX_WIDTH); - mGridRows = mInventory->getSize() / mGridColumns; - if (mGridRows == 0 || mInventory->getSize() % mGridColumns > 0) + adjustHeight(); +} + +void ItemContainer::adjustHeight() +{ + mGridRows = (mLastUsedSlot + 1) / mGridColumns; + if (mGridRows == 0 || (mLastUsedSlot + 1) % mGridColumns > 0) ++mGridRows; setHeight(mGridRows * BOX_HEIGHT); diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index f446a647..2cfd06b2 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -65,6 +65,11 @@ class ItemContainer : public gcn::Widget, virtual ~ItemContainer(); /** + * Necessary for checking how full the inventory is. + */ + void logic(); + + /** * Draws the items. */ void draw(gcn::Graphics *graphics); @@ -147,14 +152,9 @@ class ItemContainer : public gcn::Widget, void setSelectedIndex(int index); /** - * Find the current item index by the most recently used item ID - */ - void refindSelectedItem(); - - /** * Determine and set the height of the container. */ - void recalculateHeight(); + void adjustHeight(); /** * Sends out selection events to the list of selection listeners. @@ -174,6 +174,7 @@ class ItemContainer : public gcn::Widget, int mGridColumns, mGridRows; Image *mSelImg; int mSelectedIndex, mHighlightedIndex; + int mLastUsedSlot; SelectionState mSelectionStatus; bool mForceQuantity; bool mSwapItems; diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index eeb76b88..c4b1ec88 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -281,6 +281,25 @@ void NpcDialog::integerRequest(int defaultValue, int min, int max) buildLayout(); } +void NpcDialog::move(int amount) +{ + if (mActionState != NPC_ACTION_INPUT) + return; + + switch (mInputState) + { + case NPC_INPUT_INTEGER: + mIntField->setValue(mIntField->getValue() + amount); + break; + case NPC_INPUT_LIST: + mItemList->setSelected(mItemList->getSelected() - amount); + break; + case NPC_INPUT_NONE: + case NPC_INPUT_STRING: + break; + } +} + void NpcDialog::widgetResized(const gcn::Event &event) { Window::widgetResized(event); diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index bd738e81..ecce0c62 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -141,6 +141,8 @@ class NpcDialog : public Window, public gcn::ActionListener, */ void integerRequest(int defaultValue = 0, int min = 0, int max = 2000); + void move(int amount); + /** * Called when resizing the window. * diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index 317811ee..996073bd 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -53,9 +53,9 @@ PartyWindow::PartyWindow() : setResizable(true); setSaveVisible(true); setCloseButton(true); - setMinWidth(212); + setMinWidth(120); setMinHeight(200); - setDefaultSize(590, 200, 212, 200); + setDefaultSize(590, 200, 150, 200); loadWindowState(); } @@ -125,7 +125,8 @@ void PartyWindow::updateMember(int id, const std::string &memberName, member->avatar->setName(memberName); member->avatar->setOnline(online); - if (Player *player = dynamic_cast<Player*>(beingManager->findBeing(id))) + Player *player = dynamic_cast<Player*>(beingManager->findBeing(id)); + if (player && online) player->setInParty(true); } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 2dcf2628..e12ca822 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -112,12 +112,17 @@ void PopupMenu::showPopup(int x, int y, Being *being) //mBrowserBox->addRow(_(strprintf("@@follow|Follow %s@@"), name.c_str())); //mBrowserBox->addRow(_("@@buddy|Add ") + name + " to Buddy List@@"); +#ifdef TMWSERV_SUPPORT mBrowserBox->addRow(strprintf(_("@@guild|Invite %s to join your guild@@"), name.c_str())); - mBrowserBox->addRow(strprintf(_("@@party|Invite %s to join your party@@"), name.c_str())); +#endif + if (player_node->isInParty()) + mBrowserBox->addRow(strprintf(_("@@party|Invite %s to join your party@@"), name.c_str())); - /* - mBrowserBox->addRow("##3---"); - mBrowserBox->addRow(_("@@admin-kick|Kick player@@"));*/ + if (player_node->isGM()) + { + mBrowserBox->addRow("##3---"); + mBrowserBox->addRow(_("@@admin-kick|Kick player@@")); + } } break; @@ -128,13 +133,14 @@ void PopupMenu::showPopup(int x, int y, Being *being) break; case Being::MONSTER: - // Monsters can be attacked - mBrowserBox->addRow(strprintf(_("@@attack|Attack %s@@"), name.c_str())); - break; + { + // Monsters can be attacked + mBrowserBox->addRow(strprintf(_("@@attack|Attack %s@@"), name.c_str())); - /*case Being::MONSTER: - mBrowserBox->addRow(_("@@admin-kick|Kick monster@@")); - break;*/ + if (player_node->isGM()) + mBrowserBox->addRow(_("@@admin-kick|Kick monster@@")); + } + break; default: /* Other beings aren't interesting... */ diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 9add3251..1c4043f7 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -479,8 +479,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) } else if (event.getId() == "speech") { - Being::Speech val = - static_cast<Being::Speech>(mSpeechSlider->getValue()); + Being::Speech val = (Being::Speech)mSpeechSlider->getValue(); mSpeechLabel->setCaption(speechModeToString(val)); mSpeechSlider->setValue(val); config.setValue("speech", val); diff --git a/src/gui/widgets/avatar.cpp b/src/gui/widgets/avatar.cpp index b120c51f..0bbdc468 100644 --- a/src/gui/widgets/avatar.cpp +++ b/src/gui/widgets/avatar.cpp @@ -42,7 +42,7 @@ Avatar::Avatar(): mMaxHp(0) { setOpaque(false); - setSize(200, 12); + setSize(250, 12); if (avatarCount == 0) { @@ -58,7 +58,7 @@ Avatar::Avatar(): mStatus->setSize(12, 12); add(mStatus, 1, 0); mLabel = new Label; - mLabel->setSize(174, 12); + mLabel->adjustSize(); add(mLabel, 16, 0); } @@ -108,4 +108,5 @@ void Avatar::updateAvatarLabel() ss << " (" << mHp << "/" << mMaxHp << ")"; mLabel->setCaption(ss.str()); + mLabel->adjustSize(); } diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 52b9bfa6..a03d53eb 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -23,9 +23,9 @@ #include "gui/linkhandler.h" #include "gui/palette.h" -#include "gui/truetypefont.h" #include <guichan/graphics.hpp> +#include <guichan/font.hpp> #include <algorithm> @@ -71,7 +71,7 @@ void BrowserBox::addRow(const std::string &row) std::string newRow; BROWSER_LINK bLink; std::string::size_type idx1, idx2, idx3; - TrueTypeFont *font = static_cast<TrueTypeFont*>(getFont()); + gcn::Font *font = getFont(); // Use links and user defined colors if (mUseLinksAndUserColors) @@ -116,7 +116,6 @@ void BrowserBox::addRow(const std::string &row) newRow += tmp; } - // Don't use links and user defined colors else { @@ -281,7 +280,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) int x = 0, y = 0; int wrappedLines = 0; int link = 0; - TrueTypeFont *font = static_cast<TrueTypeFont*>(getFont()); + gcn::Font *font = getFont(); graphics->setColor(guiPalette->getColor(Palette::TEXT)); for (TextRowIterator i = mTextRows.begin(); i != mTextRows.end(); i++) @@ -296,10 +295,11 @@ void BrowserBox::draw(gcn::Graphics *graphics) // Check for separator lines if (row.find("---", 0) == 0) { + const int dashWidth = font->getWidth("-"); for (x = 0; x < getWidth(); x++) { font->drawString(graphics, "-", x, y); - x += font->getWidth("-") - 2; + x += dashWidth - 2; } y += font->getHeight(); continue; @@ -389,7 +389,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) { bool forced = false; char const *hyphen = "~"; - int hyphenWidth = font->getWidth(hyphen); + int hyphenWidth = font->getWidth(hyphen); /* FIXME: This code layout makes it easy to crash remote clients by talking garbage. Forged long utf-8 characters diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index d55e5da8..711680d1 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -162,13 +162,6 @@ void ChatTab::chatLog(std::string line, int own, bool ignoreRecord) lineColor = "##S"; } -#ifdef EATHENA_SUPPORT - if (tmp.nick.empty() && tmp.text.substr(0, 17) == "Visible GM status") - { - player_node->setGM(); - } -#endif - // Get the current system time time_t t; time(&t); diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index ff05d75b..b5db3de5 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -43,6 +43,7 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { {"keyMoveLeft", SDLK_LEFT, _("Move Left")}, {"keyMoveRight", SDLK_RIGHT, _("Move Right")}, {"keyAttack", SDLK_LCTRL, _("Attack")}, + {"keyTargetAttack", SDLK_x, _("Target & Attack")}, {"keySmilie", SDLK_LALT, _("Smilie")}, {"keyTalk", SDLK_t, _("Talk")}, {"keyTarget", SDLK_LSHIFT, _("Stop Attack")}, diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index d461c827..68a5efa6 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -154,6 +154,7 @@ class KeyboardConfig KEY_MOVE_LEFT, KEY_MOVE_RIGHT, KEY_ATTACK, + KEY_TARGET_ATTACK, KEY_EMOTE, KEY_TALK, KEY_TARGET, diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 059ccd31..c1423190 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -236,14 +236,17 @@ void LocalPlayer::setAction(Action action, int attackType) Player::setAction(action, attackType); } -void LocalPlayer::setGM() -{ - mIsGM = !mIsGM; - mNameColor = mIsGM ? - &guiPalette->getColor(Palette::GM) : - &guiPalette->getColor(Palette::PLAYER); - setName(getName()); - config.setValue(getName() + "GMassert", mIsGM); +void LocalPlayer::setGM(bool gm) +{ + mIsGM = gm; +} + +void LocalPlayer::setGMLevel(int level) +{ + mGMLevel = level; + + if (level > 0) + setGM(true); } void LocalPlayer::setName(const std::string &name) diff --git a/src/localplayer.h b/src/localplayer.h index bab254ab..add5c049 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -223,7 +223,9 @@ class LocalPlayer : public Player /** * Triggers whether or not to show the name as a GM name. */ - virtual void setGM(); + virtual void setGM(bool gm); + + void setGMLevel(int level); void stopAttack(); @@ -458,6 +460,8 @@ class LocalPlayer : public Player int mHp; int mMaxHp; + int mGMLevel; + Being *mTarget; FloorItem *mPickUpTarget; diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 29ed733a..34a0d70a 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -35,6 +35,8 @@ #include "npc.h" #include "playerrelations.h" +#include "gui/partywindow.h" + #include <iostream> namespace EAthena { @@ -445,12 +447,15 @@ void BeingHandler::handleMessage(MessageIn &msg) dstBeing = createBeing(id, job); } - // Fix monster jobs - if (dstBeing->getType() == Being::MONSTER) { - job -= 1002; + PartyMember *member = partyWindow->findMember(id); + if (member && member->online) + { + dynamic_cast<Player*>(dstBeing)->setInParty(true); + } } + dstBeing->setWalkSpeed(speed); dstBeing->mJob = job; hairStyle = msg.readInt16(); @@ -503,8 +508,9 @@ void BeingHandler::handleMessage(MessageIn &msg) } gmstatus = msg.readInt16(); - if ((gmstatus & 0x80) && dstBeing->getType() == Being::PLAYER) - static_cast<Player*>(dstBeing)->setGM(); + if (gmstatus & 0x80) + if (Player *player = dynamic_cast<Player*>(dstBeing)) + player->setGM(true); if (msg.getId() == SMSG_PLAYER_UPDATE_1) { diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 2f1b02ab..5e7f43c4 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -156,6 +156,9 @@ void PartyHandler::handleMessage(MessageIn &msg) } case SMSG_PARTY_SETTINGS: { + if (!partyTab) + break; + // These seem to indicate the sharing mode for exp and items short exp = msg.readInt16(); short item = msg.readInt16(); diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 29f0bac4..b7131f0a 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -262,6 +262,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) case 0x0032: player_node->FLEE = value; break; case 0x0035: player_node->mAttackSpeed = value; break; case 0x0037: player_node->mJobLevel = value; break; + case 500: player_node->setGMLevel(value); break; } if (player_node->getHp() == 0 && !deathNotice) diff --git a/src/player.cpp b/src/player.cpp index 453b8bdd..520342e3 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -58,44 +58,34 @@ void Player::setName(const std::string &name) { if (!mName && mShowName) { - if (mIsGM) + mNameColor = &guiPalette->getColor(Palette::PLAYER); + + const gcn::Color *color; + if (this == player_node) + { + color = &guiPalette->getColor(Palette::SELF); + } + else if (mIsGM) { mNameColor = &guiPalette->getColor(Palette::GM); - mName = new FlashText("(GM) " + name, - getPixelX(), - getPixelY(), - gcn::Graphics::CENTER, - &guiPalette->getColor(Palette::GM_NAME)); + color = &guiPalette->getColor(Palette::GM_NAME); + } + else if (mInParty) + { + color = &guiPalette->getColor(Palette::PARTY); } else { - mNameColor = &guiPalette->getColor(Palette::PLAYER); - - const gcn::Color *color; - if (this == player_node) - { - color = &guiPalette->getColor(Palette::SELF); - } - else if (mIsGM) - { - color = &guiPalette->getColor(Palette::GM); - } - else if (mInParty) - { - color = &guiPalette->getColor(Palette::PARTY); - } - else - { - color = &guiPalette->getColor(Palette::PC); - } - - mName = new FlashText(name, - getPixelX(), - getPixelY(), - gcn::Graphics::CENTER, - color); + color = &guiPalette->getColor(Palette::PC); } + + mName = new FlashText(name, + getPixelX(), + getPixelY(), + gcn::Graphics::CENTER, + color); } + Being::setName(name); } @@ -191,6 +181,14 @@ void Player::setGender(Gender gender) } } +void Player::setGM(bool gm) +{ + mIsGM = gm; + + if (gm && mName) + mName->setColor(&guiPalette->getColor(Palette::GM)); +} + void Player::setHairStyle(int style, int color) { style = style < 0 ? mHairStyle : style % mNumberOfHairstyles; diff --git a/src/player.h b/src/player.h index 330d0c14..bb44f462 100644 --- a/src/player.h +++ b/src/player.h @@ -67,7 +67,7 @@ class Player : public Being /** * Triggers whether or not to show the name as a GM name. */ - virtual void setGM() { mIsGM = true; } + virtual void setGM(bool gm); /** * Sets the hair style and color for this player. |