summaryrefslogtreecommitdiff
path: root/src/gui/popups
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-14 19:25:00 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-14 19:25:00 +0300
commit8ea20d3e1f61bcfeccf6885e11cacddeb014fe0f (patch)
treebda5dc8f66925aed8a1671a9d806a407af7bef3f /src/gui/popups
parentf3781554bf946a22ac307d1c8fe6154db05bbf2e (diff)
downloadmanaverse-8ea20d3e1f61bcfeccf6885e11cacddeb014fe0f.tar.gz
manaverse-8ea20d3e1f61bcfeccf6885e11cacddeb014fe0f.tar.bz2
manaverse-8ea20d3e1f61bcfeccf6885e11cacddeb014fe0f.tar.xz
manaverse-8ea20d3e1f61bcfeccf6885e11cacddeb014fe0f.zip
Add skill cast type option in skills window.
Can be changed, but for now unused.
Diffstat (limited to 'src/gui/popups')
-rw-r--r--src/gui/popups/popupmenu.cpp57
-rw-r--r--src/gui/popups/popupmenu.h2
-rw-r--r--src/gui/popups/skillpopup.cpp39
-rw-r--r--src/gui/popups/skillpopup.h1
4 files changed, 93 insertions, 6 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index d0896efaa..e7e866491 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2361,7 +2361,7 @@ void PopupMenu::showNpcDialogPopup(const BeingId npcId,
void PopupMenu::showSkillPopup(const SkillInfo *const info)
{
- if (!info || info->level <= 1)
+ if (!info)
return;
setMousePos();
@@ -2373,10 +2373,17 @@ void PopupMenu::showSkillPopup(const SkillInfo *const info)
// TRANSLATORS: popup menu header
mBrowserBox->addRow(_("Skill"));
- mBrowserBox->addRow("/showskilllevels 'ITEMID'",
+ if (info->level > 1)
+ {
+ mBrowserBox->addRow("/showskilllevels 'ITEMID'",
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: set skill level
+ _("Skill level..."));
+ }
+ mBrowserBox->addRow("/showskilltypes 'ITEMID'",
// TRANSLATORS: popup menu item
- // TRANSLATORS: set skill level
- _("Set skill level"));
+ // TRANSLATORS: set skill cast type
+ _("Skill cast type..."));
// TRANSLATORS: popup menu item
// TRANSLATORS: close menu
mBrowserBox->addRow("cancel", _("Cancel"));
@@ -2422,6 +2429,48 @@ void PopupMenu::showSkillLevelMenu()
showPopup(mX, mY);
}
+void PopupMenu::showSkillTypePopup(const SkillInfo *const info)
+{
+ if (!info)
+ return;
+ setMousePos();
+
+ // using mItemId as skill id
+ mItemId = info->id;
+ // using mItemIndex as skill level
+ mItemIndex = info->level;
+
+ for (int f = 0; f < maxCards; f ++)
+ mItemCards[f] = 0;
+ mBrowserBox->clearRows();
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: skill cast type header
+ mBrowserBox->addRow(_("Select skill cast type"));
+ mBrowserBox->addRow(strprintf("/selectskilltype %d 0", mItemId),
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: skill cast type
+ _("Default"));
+ mBrowserBox->addRow(strprintf("/selectskilltype %d 1", mItemId),
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: skill cast type
+ _("Target"));
+ mBrowserBox->addRow(strprintf("/selectskilltype %d 2", mItemId),
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: skill cast type
+ _("Mouse position"));
+ mBrowserBox->addRow(strprintf("/selectskilltype %d 3", mItemId),
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: skill cast type
+ _("Self"));
+ mBrowserBox->addRow("##3---");
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: close menu
+ mBrowserBox->addRow("cancel", _("Cancel"));
+
+ showPopup(mX, mY);
+}
+
void PopupMenu::showPopup(int x, int y)
{
const int pad2 = 2 * mPadding;
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index a7a745873..ba88e93f1 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -165,6 +165,8 @@ class PopupMenu final : public Popup, public LinkHandler
void showSkillLevelPopup(const SkillInfo *const info);
+ void showSkillTypePopup(const SkillInfo *const info);
+
void showCraftPopup();
void showEmoteType();
diff --git a/src/gui/popups/skillpopup.cpp b/src/gui/popups/skillpopup.cpp
index f6e1f19a7..4c9af3d0f 100644
--- a/src/gui/popups/skillpopup.cpp
+++ b/src/gui/popups/skillpopup.cpp
@@ -46,6 +46,7 @@ SkillPopup::SkillPopup() :
mSkillDesc(new TextBox(this)),
mSkillEffect(new TextBox(this)),
mSkillLevel(new TextBox(this)),
+ mSkillCastType(new TextBox(this)),
mLastId(0U),
mLastLevel(-1)
{
@@ -68,6 +69,11 @@ SkillPopup::SkillPopup() :
mSkillLevel->setPosition(0, 3 * fontHeight);
mSkillLevel->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP),
getThemeColor(ThemeColorId::POPUP_OUTLINE));
+
+ mSkillCastType->setEditable(false);
+ mSkillCastType->setPosition(0, 4 * fontHeight);
+ mSkillCastType->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP),
+ getThemeColor(ThemeColorId::POPUP_OUTLINE));
}
void SkillPopup::postInit()
@@ -77,6 +83,7 @@ void SkillPopup::postInit()
add(mSkillDesc);
add(mSkillEffect);
add(mSkillLevel);
+ add(mSkillCastType);
addMouseListener(this);
}
@@ -136,6 +143,27 @@ void SkillPopup::show(const SkillInfo *const skill,
196);
}
}
+ std::string castStr;
+ switch (skill->customCastType)
+ {
+ case CastType::Default:
+ default:
+ castStr = _("Default");
+ break;
+ case CastType::Target:
+ castStr = _("Target");
+ break;
+ case CastType::Position:
+ castStr = _("Mouse position");
+ break;
+ case CastType::Self:
+ castStr = _("Self position");
+ break;
+ }
+ mSkillCastType->setTextWrapped(strprintf(
+ // TRANSLATORS: skill cast type
+ _("Cast type: %s"),
+ castStr.c_str()), 196);
int minWidth = mSkillName->getWidth();
@@ -147,25 +175,32 @@ void SkillPopup::show(const SkillInfo *const skill,
minWidth = mSkillEffect->getMinWidth();
if (mSkillLevel->getMinWidth() > minWidth)
minWidth = mSkillLevel->getMinWidth();
+ if (mSkillCastType->getMinWidth() > minWidth)
+ minWidth = mSkillCastType->getMinWidth();
const int numRowsDesc = mSkillDesc->getNumberOfRows();
const int numRowsEffect = mSkillEffect->getNumberOfRows();
const int numRowsLevel = mSkillLevel->getNumberOfRows();
+ const int numRowsCast = mSkillCastType->getNumberOfRows();
const int height = getFont()->getHeight();
if (skill->skillEffect.empty())
{
setContentSize(minWidth,
- (numRowsDesc + numRowsLevel + 1) * height);
+ (numRowsDesc + numRowsLevel + numRowsCast + 1) * height);
mSkillLevel->setPosition(0, (numRowsDesc + 1) * height);
+ mSkillCastType->setPosition(0, (numRowsDesc + 2) * height);
}
else
{
setContentSize(minWidth,
- (numRowsDesc + numRowsLevel + numRowsEffect + 1) * height);
+ (numRowsDesc + numRowsLevel + numRowsEffect + numRowsCast + 1) *
+ height);
mSkillEffect->setPosition(0, (numRowsDesc + 1) * height);
mSkillLevel->setPosition(0,
(numRowsDesc + numRowsEffect + 1) * height);
+ mSkillCastType->setPosition(0,
+ (numRowsDesc + numRowsEffect + 2) * height);
}
mSkillDesc->setPosition(0, 1 * height);
diff --git a/src/gui/popups/skillpopup.h b/src/gui/popups/skillpopup.h
index 33d6d50cc..be416330a 100644
--- a/src/gui/popups/skillpopup.h
+++ b/src/gui/popups/skillpopup.h
@@ -66,6 +66,7 @@ class SkillPopup final : public Popup
TextBox *mSkillDesc A_NONNULLPOINTER;
TextBox *mSkillEffect A_NONNULLPOINTER;
TextBox *mSkillLevel A_NONNULLPOINTER;
+ TextBox *mSkillCastType A_NONNULLPOINTER;
unsigned int mLastId;
int mLastLevel;
};