From d0571ca16bb4ef11a718cfa78dc29b57080fcc72 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 5 Jul 2011 03:41:13 +0300 Subject: Add ability to send client states to other clients. Using for this emotes. --- src/gui/beingpopup.cpp | 10 ++++++++++ src/gui/popupmenu.cpp | 41 +++++++++++++++++++++++++++++++++++------ src/gui/setup_other.cpp | 3 +++ src/gui/theme.cpp | 3 ++- src/gui/theme.h | 1 + 5 files changed, 51 insertions(+), 7 deletions(-) (limited to 'src/gui') diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp index 2ba79d1a1..e5dc602a0 100644 --- a/src/gui/beingpopup.cpp +++ b/src/gui/beingpopup.cpp @@ -28,6 +28,7 @@ #include "gui/gui.h" #include "gui/palette.h" +#include "gui/theme.h" #include "gui/widgets/label.h" @@ -96,6 +97,15 @@ void BeingPopup::show(int x, int y, Being *b) else mBeingName->setFont(gui->getSecureFont()); } + if (b->isAdvanced()) + { + mBeingName->setForegroundColor(Theme::getThemeColor( + Theme::PLAYER_ADVANCED)); + } + else + { + mBeingName->setForegroundColor(Theme::getThemeColor(Theme::TEXT)); + } mBeingName->adjustSize(); label1->setCaption(""); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 0ede3d122..ad62f79a8 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -248,8 +248,23 @@ void PopupMenu::showPopup(int x, int y, Being *being) if (player_relations.getDefault() & PlayerRelation::TRADE) { mBrowserBox->addRow("##3---"); - mBrowserBox->addRow(strprintf("@@buy|%s@@", _("Buy"))); - mBrowserBox->addRow(strprintf("@@sell|%s@@", _("Sell"))); + if (being->isAdvanced()) + { + if (being->isShopEnabled()) + { + mBrowserBox->addRow(strprintf( + "@@buy|%s@@", _("Buy"))); + mBrowserBox->addRow(strprintf( + "@@sell|%s@@", _("Sell"))); + } + } + else + { + mBrowserBox->addRow(strprintf( + "@@buy|%s@@", _("Buy (?)"))); + mBrowserBox->addRow(strprintf( + "@@sell|%s@@", _("Sell (?)"))); + } } } break; @@ -428,8 +443,8 @@ void PopupMenu::showPlayerPopup(int x, int y, std::string nick) mBrowserBox->addRow("##3---"); if (player_relations.getDefault() & PlayerRelation::TRADE) { - mBrowserBox->addRow(strprintf("@@buy|%s@@", _("Buy"))); - mBrowserBox->addRow(strprintf("@@sell|%s@@", _("Sell"))); + mBrowserBox->addRow(strprintf("@@buy|%s@@", _("Buy (?)"))); + mBrowserBox->addRow(strprintf("@@sell|%s@@", _("Sell (?)"))); } mBrowserBox->addRow(strprintf("@@name|%s@@", _("Add name to chat"))); @@ -652,8 +667,22 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab) if (player_relations.getDefault() & PlayerRelation::TRADE) { mBrowserBox->addRow("##3---"); - mBrowserBox->addRow(strprintf("@@buy|%s@@", _("Buy"))); - mBrowserBox->addRow(strprintf("@@sell|%s@@", _("Sell"))); + if (being->isAdvanced()) + { + if (being->isShopEnabled()) + { + mBrowserBox->addRow(strprintf( + "@@buy|%s@@", _("Buy"))); + mBrowserBox->addRow(strprintf( + "@@sell|%s@@", _("Sell"))); + } + } + else + { + mBrowserBox->addRow(strprintf("@@buy|%s@@", _("Buy (?)"))); + mBrowserBox->addRow(strprintf( + "@@sell|%s@@", _("Sell (?)"))); + } } mBrowserBox->addRow("##3---"); diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp index 0cad07bc1..ca70133a2 100644 --- a/src/gui/setup_other.cpp +++ b/src/gui/setup_other.cpp @@ -127,6 +127,9 @@ Setup_Other::Setup_Other() new SetupItemCheckBox(_("Enable attack filter"), "", "enableAttackFilter", this, "enableAttackFilterEvent"); + new SetupItemCheckBox(_("Enable advert protocol"), "", + "enableAdvert", this, "enableAdvertEvent"); + new SetupItemLabel(_("Shop"), "", this); diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 0817df564..92613a3b3 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -638,7 +638,8 @@ static int readColorType(const std::string &type) "AMMO", "SERVER_VERSION_NOT_SUPPORTED", "WARNING", - "CHARM" + "CHARM", + "PLAYER_ADVANCED" }; if (type.empty()) diff --git a/src/gui/theme.h b/src/gui/theme.h index e483bff69..120214232 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -183,6 +183,7 @@ class Theme : public Palette, public ConfigListener SERVER_VERSION_NOT_SUPPORTED, WARNING, CHARM, + PLAYER_ADVANCED, THEME_COLORS_END }; -- cgit v1.2.3-60-g2f50