From 38c827f67ba233ee11a964eff76714bbbedce4e9 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 12 May 2009 21:29:28 +0200 Subject: Only scroll down the inventory as far as necessary ItemContainer now adjusts its number of rows to the last used slot. --- src/gui/itemcontainer.cpp | 23 +++++++++++++++++++++-- src/gui/itemcontainer.h | 13 +++++++------ 2 files changed, 28 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 6cbdabb2..26382cd2 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); @@ -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 @@ -64,6 +64,11 @@ class ItemContainer : public gcn::Widget, */ virtual ~ItemContainer(); + /** + * Necessary for checking how full the inventory is. + */ + void logic(); + /** * Draws the items. */ @@ -146,15 +151,10 @@ 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; -- cgit v1.2.3-70-g09d2 From 81efdcf44bc591fb37b724aebff1421bb476556b Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 13:36:34 -0600 Subject: Only set the right characters in party Instead of every character on the account (for eAthena). --- src/gui/partywindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index 317811ee..3da59e9f 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -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(beingManager->findBeing(id))) + Player *player = dynamic_cast(beingManager->findBeing(id)); + if (player && player->getName() == memberName) player->setInParty(true); } -- cgit v1.2.3-70-g09d2 From 535a14adae4cdc5e2b8610b1c8e30501c9e95d5f Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Tue, 12 May 2009 21:45:51 +0200 Subject: GCC3x does not like static_cast to enum, use old style instead. --- src/gui/setup_video.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') 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(mSpeechSlider->getValue()); + Being::Speech val = (Being::Speech)mSpeechSlider->getValue(); mSpeechLabel->setCaption(speechModeToString(val)); mSpeechSlider->setValue(val); config.setValue("speech", val); -- cgit v1.2.3-70-g09d2 From f05ae6aa57a2855a0c27360689a92f923a8ef9aa Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Tue, 12 May 2009 22:28:44 +0200 Subject: Add target + attack key, defaults to x. --- src/game.cpp | 17 +++++++++++++++++ src/keyboardconfig.cpp | 1 + src/keyboardconfig.h | 1 + 3 files changed, 19 insertions(+) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index b56cbdde..c07d6520 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -923,6 +923,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/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, -- cgit v1.2.3-70-g09d2 From 7b0309c45591a98846b650e789829a0b0de309e9 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 16:03:07 -0600 Subject: Adjust the context menu's invite options Guild will no longer show for eAthena builds and party will only show if you are in a party. --- src/gui/popupmenu.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 2dcf2628..fdb8c5ac 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -112,8 +112,11 @@ 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---"); -- cgit v1.2.3-70-g09d2 From f691f9a7b121e9d32df9f648c629c98ae8d25966 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Wed, 13 May 2009 00:50:06 +0200 Subject: BrowserBox doesn't need to know about the TrueTypeFont class --- src/gui/widgets/browserbox.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') 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 +#include #include @@ -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(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(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 -- cgit v1.2.3-70-g09d2 From 1cf7ca1327d903d6857db80f7eb1acbde8533030 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 19:49:09 -0600 Subject: Fix player party hilighting issues Causes when other party memebrs were on the same map and they came in range, they wouldn't get hilighted. Also simplify the check for correct player (avoiding problems with multiple characters on an account). --- src/gui/partywindow.cpp | 2 +- src/net/ea/beinghandler.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index 3da59e9f..8958c1ec 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -126,7 +126,7 @@ void PartyWindow::updateMember(int id, const std::string &memberName, member->avatar->setOnline(online); Player *player = dynamic_cast(beingManager->findBeing(id)); - if (player && player->getName() == memberName) + if (player && online) player->setInParty(true); } diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 29ed733a..5a49442c 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 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(dstBeing)->setInParty(true); + } } + dstBeing->setWalkSpeed(speed); dstBeing->mJob = job; hairStyle = msg.readInt16(); -- cgit v1.2.3-70-g09d2 From 94716c19748ab87a0a215f05e15ad6cac1008f07 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 21:21:18 -0600 Subject: Fix a rare segfault for eAthena and the partyTab --- src/net/ea/partyhandler.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') 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(); -- cgit v1.2.3-70-g09d2 From 85ce3c416f6d6060c522ef6b3b5834f27f83cc5b Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 22:23:58 -0600 Subject: Fix up handling of GM status --- src/gui/popupmenu.cpp | 21 +++++++++------- src/gui/widgets/chattab.cpp | 2 +- src/localplayer.cpp | 8 ++---- src/localplayer.h | 2 +- src/net/ea/beinghandler.cpp | 5 ++-- src/player.cpp | 60 ++++++++++++++++++++++----------------------- src/player.h | 2 +- 7 files changed, 49 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index fdb8c5ac..e12ca822 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -118,9 +118,11 @@ void PopupMenu::showPopup(int x, int y, Being *being) 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; @@ -131,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/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index d55e5da8..defc06f0 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -165,7 +165,7 @@ void ChatTab::chatLog(std::string line, int own, bool ignoreRecord) #ifdef EATHENA_SUPPORT if (tmp.nick.empty() && tmp.text.substr(0, 17) == "Visible GM status") { - player_node->setGM(); + player_node->setGM(true); } #endif diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 059ccd31..24502dd1 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -236,13 +236,9 @@ void LocalPlayer::setAction(Action action, int attackType) Player::setAction(action, attackType); } -void LocalPlayer::setGM() +void LocalPlayer::setGM(bool gm) { - mIsGM = !mIsGM; - mNameColor = mIsGM ? - &guiPalette->getColor(Palette::GM) : - &guiPalette->getColor(Palette::PLAYER); - setName(getName()); + mIsGM = gm; config.setValue(getName() + "GMassert", mIsGM); } diff --git a/src/localplayer.h b/src/localplayer.h index bab254ab..39f438d1 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -223,7 +223,7 @@ 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 stopAttack(); diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 5a49442c..34a0d70a 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -508,8 +508,9 @@ void BeingHandler::handleMessage(MessageIn &msg) } gmstatus = msg.readInt16(); - if ((gmstatus & 0x80) && dstBeing->getType() == Being::PLAYER) - static_cast(dstBeing)->setGM(); + if (gmstatus & 0x80) + if (Player *player = dynamic_cast(dstBeing)) + player->setGM(true); if (msg.getId() == SMSG_PLAYER_UPDATE_1) { 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. -- cgit v1.2.3-70-g09d2 From 92c331d47a2559b6a820395b95446d4fba3f3eee Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Wed, 13 May 2009 06:06:21 -0600 Subject: Remove Aethyra's custom visible GM system Very hackish and would require altering eAthena. It also isn't very portable; if you use the same character name on multiple servers and are a GM on one of them, the client will try to make you a GM on the other. --- src/gui/chat.cpp | 8 -------- src/gui/widgets/chattab.cpp | 7 ------- src/localplayer.cpp | 1 - 3 files changed, 16 deletions(-) (limited to 'src') 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/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index defc06f0..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(true); - } -#endif - // Get the current system time time_t t; time(&t); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 24502dd1..cb900b98 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -239,7 +239,6 @@ void LocalPlayer::setAction(Action action, int attackType) void LocalPlayer::setGM(bool gm) { mIsGM = gm; - config.setValue(getName() + "GMassert", mIsGM); } void LocalPlayer::setName(const std::string &name) -- cgit v1.2.3-70-g09d2 From f19d3f4db065472141b9c6bdf63726138006cb14 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Wed, 13 May 2009 07:16:41 -0600 Subject: Add GM notification handling --- src/localplayer.cpp | 8 ++++++++ src/localplayer.h | 4 ++++ src/net/ea/playerhandler.cpp | 1 + 3 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/localplayer.cpp b/src/localplayer.cpp index cb900b98..c1423190 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -241,6 +241,14 @@ 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) { if (mName) diff --git a/src/localplayer.h b/src/localplayer.h index 39f438d1..add5c049 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -225,6 +225,8 @@ class LocalPlayer : public Player */ 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/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) -- cgit v1.2.3-70-g09d2 From 639260f2e7cccee8092c6ba51db8f1a6e7152fa4 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Thu, 14 May 2009 00:38:08 +1200 Subject: Modify PartyWindow sizing again Rather than expanding PartyWindow again, call mLabel->adjustSize(); and let players resize the window if they need to. Also shrink the minimum size of the PartyWindow. --- src/gui/partywindow.cpp | 4 ++-- src/gui/widgets/avatar.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index 8958c1ec..fdfe5a54 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, 120, 200); loadWindowState(); } 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(); } -- cgit v1.2.3-70-g09d2 From 41465e6770a901ceb9a252f396bb369eab67ff7f Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Wed, 13 May 2009 07:49:07 -0600 Subject: Adjust the default width of the PartyWindow more --- src/gui/partywindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index fdfe5a54..996073bd 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -55,7 +55,7 @@ PartyWindow::PartyWindow() : setCloseButton(true); setMinWidth(120); setMinHeight(200); - setDefaultSize(590, 200, 120, 200); + setDefaultSize(590, 200, 150, 200); loadWindowState(); } -- cgit v1.2.3-70-g09d2 From d401dcb26695bddec8c39edc8151dbe309378519 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Wed, 13 May 2009 10:32:58 -0600 Subject: Disable keyboard control of ItemContainers for now --- src/gui/itemcontainer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 26382cd2..54aa818b 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -192,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); @@ -216,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: @@ -230,7 +230,7 @@ void ItemContainer::keyReleased(gcn::KeyEvent &event) case Key::RIGHT_CONTROL: mDescItems = false; break; - } + }*/ } void ItemContainer::mousePressed(gcn::MouseEvent &event) -- cgit v1.2.3-70-g09d2 From 7cddbca0dcfff234b6c6f124cb91840279c36118 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Wed, 13 May 2009 10:57:05 -0600 Subject: Allow more control of NpcDialog using the keyboard The move up and move down keys will now let you navigate the list mode and change the value on the integer mode. --- src/game.cpp | 5 +++++ src/gui/npcdialog.cpp | 16 ++++++++++++++++ src/gui/npcdialog.h | 2 ++ 3 files changed, 23 insertions(+) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index c07d6520..d60a4225 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -582,6 +582,11 @@ 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); } diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index eeb76b88..3fa86b28 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -281,6 +281,22 @@ 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; + } +} + 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. * -- cgit v1.2.3-70-g09d2 From b5ad7e490f0f429a5abac2acae48ecf25485256f Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Wed, 13 May 2009 19:36:56 +0200 Subject: Fixed two compiler warnings Enumeration values not handled in switch and an ambiguous else. --- src/game.cpp | 2 ++ src/gui/npcdialog.cpp | 3 +++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index d60a4225..59c57607 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -583,10 +583,12 @@ void Game::handleInput() 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); + } } diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 3fa86b28..c4b1ec88 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -294,6 +294,9 @@ void NpcDialog::move(int amount) case NPC_INPUT_LIST: mItemList->setSelected(mItemList->getSelected() - amount); break; + case NPC_INPUT_NONE: + case NPC_INPUT_STRING: + break; } } -- cgit v1.2.3-70-g09d2