summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-11 01:34:11 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-11 01:34:11 +0200
commitfcced13d9972ac70f0f01f19583b7868e255b6a7 (patch)
tree9b01df102c5f9ba032ea0f9bc413dd707e99d88b /src
parent311783bebbe2bed366dca5097697ce34c690292d (diff)
parentef1b9856c86512fe73154c17da3ea98a7cd5f896 (diff)
downloadmv-fcced13d9972ac70f0f01f19583b7868e255b6a7.tar.gz
mv-fcced13d9972ac70f0f01f19583b7868e255b6a7.tar.bz2
mv-fcced13d9972ac70f0f01f19583b7868e255b6a7.tar.xz
mv-fcced13d9972ac70f0f01f19583b7868e255b6a7.zip
Merge branch 'master' into invfiler
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp63
-rw-r--r--src/being.h3
-rw-r--r--src/defaults.cpp4
-rw-r--r--src/gui/charselectdialog.cpp2
-rw-r--r--src/gui/login.cpp8
-rw-r--r--src/gui/serverdialog.cpp18
-rw-r--r--src/gui/serverdialog.h2
-rw-r--r--src/gui/setup_colors.cpp2
-rw-r--r--src/gui/setup_other.cpp17
-rw-r--r--src/gui/setup_other.h3
-rw-r--r--src/gui/userpalette.cpp5
-rw-r--r--src/gui/userpalette.h2
-rw-r--r--src/localplayer.cpp3
-rw-r--r--src/main.h4
-rw-r--r--src/net/tmwa/beinghandler.cpp8
-rw-r--r--src/net/tmwa/buysellhandler.cpp22
-rw-r--r--src/net/tmwa/charserverhandler.cpp10
-rw-r--r--src/net/tmwa/inventoryhandler.cpp4
-rw-r--r--src/net/tmwa/loginhandler.cpp5
-rw-r--r--src/net/tmwa/playerhandler.cpp3
-rw-r--r--src/net/tmwa/protocol.h2
-rw-r--r--src/resources/itemdb.cpp4
-rw-r--r--src/sound.cpp32
-rw-r--r--src/sound.h2
24 files changed, 176 insertions, 52 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 08893c2f4..4f31e402c 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -71,6 +71,7 @@
#include "gui/widgets/chattab.h"
#include "utils/dtor.h"
+#include "utils/gettext.h"
#include "utils/stringutils.h"
#include "utils/xml.h"
@@ -168,6 +169,7 @@ bool Being::mLowTraffic = true;
bool Being::mDrawHotKeys = true;
bool Being::mShowBattleEvents = false;
bool Being::mShowMobHP = false;
+bool Being::mShowOwnHP = false;
std::list<BeingCacheEntry*> beingInfoCache;
@@ -476,7 +478,7 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
gcn::Font *font = 0;
std::string damage = amount ? toString(amount) : type == FLEE ?
- "dodge" : "miss";
+ _("dodge") : _("miss");
const gcn::Color *color;
if (gui)
@@ -566,7 +568,15 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
mDamageTaken += amount;
if (mInfo)
{
- sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT));
+ if (attacker)
+ {
+ sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT),
+ attacker->getTileX(), attacker->getTileY());
+ }
+ else
+ {
+ sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT));
+ }
if (!mInfo->isStaticMaxHP())
{
if (!mHP && mInfo->getMaxHP() < mDamageTaken)
@@ -616,7 +626,7 @@ void Being::handleAttack(Being *victim, int damage,
}
sound.playSfx(mInfo->getSound((damage > 0) ?
- SOUND_EVENT_HIT : SOUND_EVENT_MISS));
+ SOUND_EVENT_HIT : SOUND_EVENT_MISS), mX, mY);
}
void Being::setName(const std::string &name)
@@ -902,7 +912,7 @@ void Being::setAction(Action action, int attackType _UNUSED_)
case DEAD:
currentAction = SpriteAction::DEAD;
if (mInfo)
- sound.playSfx(mInfo->getSound(SOUND_EVENT_DIE));
+ sound.playSfx(mInfo->getSound(SOUND_EVENT_DIE), mX, mY);
break;
case STAND:
currentAction = SpriteAction::STAND;
@@ -1550,6 +1560,7 @@ void Being::reReadConfig()
mDrawHotKeys = config.getBoolValue("drawHotKeys");
mShowBattleEvents = config.getBoolValue("showBattleEvents");
mShowMobHP = config.getBoolValue("showMobHP");
+ mShowOwnHP = config.getBoolValue("showOwnHP");
mUpdateConfigTime = cur_time;
}
@@ -1744,42 +1755,48 @@ bool Being::drawSpriteAt(Graphics *graphics, int x, int y) const
2 * attackRange + 32, 2 * attackRange + 32));
}
- if (mShowMobHP && player_node && player_node->getTarget() == this
+ if (mShowMobHP && mInfo && player_node && player_node->getTarget() == this
&& getType() == MONSTER)
{
// show hp bar here
- drawHpBar(graphics, x - 50 + 16, y + 32 - 6, 2 * 50, 4);
+ int maxHP = mMaxHP;
+ if (!maxHP)
+ maxHP = mInfo->getMaxHP();
+
+ drawHpBar(graphics, maxHP, mHP, mDamageTaken,
+ UserPalette::MONSTER_HP, UserPalette::MONSTER_HP2,
+ x - 50 + 16, y + 32 - 6, 2 * 50, 4);
+ }
+ if (mShowOwnHP && player_node == this && mAction != DEAD)
+ {
+ drawHpBar(graphics, PlayerInfo::getAttribute(MAX_HP),
+ PlayerInfo::getAttribute(HP), 0,
+ UserPalette::PLAYER_HP, UserPalette::PLAYER_HP2,
+ x - 50 + 16, y + 32 - 6, 2 * 50, 4);
}
return res;
}
-void Being::drawHpBar(Graphics *graphics, int x, int y,
+void Being::drawHpBar(Graphics *graphics, int maxHP, int hp, int damage,
+ int color1, int color2, int x, int y,
int width, int height) const
{
- if (!mInfo)
- return;
-
- int maxHP = mMaxHP;
-
- if (!maxHP)
- maxHP = mInfo->getMaxHP();
-
if (maxHP <= 0)
return;
- if (!mHP && maxHP < mHP)
+ if (!hp && maxHP < hp)
return;
float p;
- if (mHP)
+ if (hp)
{
- p = static_cast<float>(maxHP) / static_cast<float>(mHP);
+ p = static_cast<float>(maxHP) / static_cast<float>(hp);
}
- else if (maxHP != mDamageTaken)
+ else if (maxHP != damage)
{
p = static_cast<float>(maxHP)
- / static_cast<float>(maxHP - mDamageTaken);
+ / static_cast<float>(maxHP - damage);
}
else
{
@@ -1791,8 +1808,7 @@ void Being::drawHpBar(Graphics *graphics, int x, int y,
int dx = width / p;
- graphics->setColor(userPalette->getColorWithAlpha(
- UserPalette::MONSTER_HP));
+ graphics->setColor(userPalette->getColorWithAlpha(color1));
graphics->fillRectangle(gcn::Rectangle(
x, y, dx, height));
@@ -1800,8 +1816,7 @@ void Being::drawHpBar(Graphics *graphics, int x, int y,
if (width - dx <= 0)
return;
- graphics->setColor(userPalette->getColorWithAlpha(
- UserPalette::MONSTER_HP2));
+ graphics->setColor(userPalette->getColorWithAlpha(color2));
graphics->fillRectangle(gcn::Rectangle(
x + dx, y, width - dx, height));
diff --git a/src/being.h b/src/being.h
index 09466f5af..f9731366a 100644
--- a/src/being.h
+++ b/src/being.h
@@ -520,6 +520,7 @@ class Being : public ActorSprite, public ConfigListener
int posX, int posY) const;
void drawHpBar(Graphics *graphics, int x, int y,
+ int maxHP, int hp, int damage, int color1, int color2,
int width, int height) const;
static void load();
@@ -751,7 +752,7 @@ class Being : public ActorSprite, public ConfigListener
static bool mDrawHotKeys;
static bool mShowBattleEvents;
static bool mShowMobHP;
-// std::string mDisplayName;
+ static bool mShowOwnHP;
unsigned int mMoveTime;
unsigned int mAttackTime;
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 0628aa72c..da5aa4e84 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -189,6 +189,8 @@ DefaultsData* getConfigDefaults()
AddDEF(configData, "enableBattleTab", false);
AddDEF(configData, "showBattleEvents", false);
AddDEF(configData, "showMobHP", true);
+ AddDEF(configData, "showOwnHP", true);
+ AddDEF(configData, "usePersistentIP", false);
return configData;
}
@@ -219,6 +221,8 @@ DefaultsData* getBrandingDefaults()
AddDEF(brandingData, "guiPath", "graphics/gui/");
AddDEF(brandingData, "guiThemePath", "themes/");
AddDEF(brandingData, "fontsPath", "fonts/");
+
+ AddDEF(brandingData, "wallpaperFile", "");
return brandingData;
}
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index d95930108..da1f59e46 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -433,7 +433,7 @@ void CharacterDisplay::update()
mButton->setCaption(_("Choose"));
mButton->setActionEventId("use");
mName->setCaption(strprintf("%s", character->getName().c_str()));
- mLevel->setCaption(strprintf("Level %d",
+ mLevel->setCaption(strprintf(_("Level %d"),
mCharacter->data.mAttributes[LEVEL]));
mMoney->setCaption(Units::formatCurrency(
mCharacter->data.mAttributes[MONEY]));
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 997895c95..b6139c6d0 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -53,9 +53,9 @@ std::string LoginDialog::savedPasswordKey = "";
const char *UPDATE_TYPE_TEXT[3] =
{
- _("Normal"),
- _("Auto Close"),
- _("Skip"),
+ N_("Normal"),
+ N_("Auto Close"),
+ N_("Skip"),
};
class UpdateTypeModel : public gcn::ListModel
@@ -74,7 +74,7 @@ public:
if (i >= getNumberOfElements() || i < 0)
return _("???");
- return UPDATE_TYPE_TEXT[i];
+ return gettext(UPDATE_TYPE_TEXT[i]);
}
};
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index c7e1d0f94..3556efc35 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -211,7 +211,8 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
mDownload(0),
mDownloadProgress(-1.0f),
mServers(ServerInfos()),
- mServerInfo(serverInfo)
+ mServerInfo(serverInfo),
+ mPersistentIPCheckBox(false)
{
if (isSafeMode)
setCaption("Choose Your Server *** SAFE MODE ***");
@@ -223,6 +224,9 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
Label *typeLabel = new Label(_("Server type:"));
mServerNameField = new TextField(mServerInfo->hostname);
mPortField = new TextField(toString(mServerInfo->port));
+ mPersistentIPCheckBox = new CheckBox(_("Use same ip for game sub servers"),
+ config.getBoolValue("usePersistentIP"),
+ this, "persitent ip");
loadCustomServers();
@@ -264,11 +268,12 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
place(1, 2, mTypeField, 5).setPadding(3);
place(0, 3, usedScroll, 6, 5).setPadding(3);
place(0, 8, mDescription, 6);
- place(0, 9, mManualEntryButton);
- place(1, 9, mDeleteButton);
- place(2, 9, mLoadButton);
- place(4, 9, mQuitButton);
- place(5, 9, mConnectButton);
+ place(0, 9, mPersistentIPCheckBox, 6);
+ place(0, 10, mManualEntryButton);
+ place(1, 10, mDeleteButton);
+ place(2, 10, mLoadButton);
+ place(4, 10, mQuitButton);
+ place(5, 10, mConnectButton);
// Make sure the list has enough height
getLayout().setRowHeight(3, 80);
@@ -390,6 +395,7 @@ void ServerDialog::action(const gcn::ActionEvent &event)
LoginDialog::savedPassword = "";
}
+ config.setValue("usePersistentIP", mPersistentIPCheckBox->isSelected());
Client::setState(STATE_CONNECT_SERVER);
}
}
diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h
index b9a67e246..e16dd09b5 100644
--- a/src/gui/serverdialog.h
+++ b/src/gui/serverdialog.h
@@ -23,6 +23,7 @@
#define SERVERDIALOG_H
#include "gui/widgets/window.h"
+#include "gui/widgets/checkbox.h"
#include "net/download.h"
#include "net/serverinfo.h"
@@ -199,6 +200,7 @@ class ServerDialog : public Window,
ServerInfos mServers;
ServerInfo *mServerInfo;
+ CheckBox *mPersistentIPCheckBox;
};
#endif
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 76510a283..68d517cae 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -302,6 +302,8 @@ void Setup_Colors::valueChanged(const gcn::SelectionEvent &event _UNUSED_)
case UserPalette::ROAD_POINT:
case UserPalette::MONSTER_HP:
case UserPalette::MONSTER_HP2:
+ case UserPalette::PLAYER_HP:
+ case UserPalette::PLAYER_HP2:
mGradDelayLabel->setCaption(_("Alpha:"));
mGradDelayText->setRange(0, 255);
mGradDelaySlider->setScale(0, 255);
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index 54ec1c65d..5a2b77a81 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -63,6 +63,7 @@
#define ACTION_WARP_PARTICLE "warp particle"
#define ACTION_AUTO_SHOP "auto shop"
#define ACTION_SHOW_MOB_HP "show mob hp"
+#define ACTION_SHOW_OWN_HP "show own hp"
Setup_Other::Setup_Other():
mShowMonstersTakedDamage(config.getBoolValue("showMonstersTakedDamage")),
@@ -87,7 +88,8 @@ Setup_Other::Setup_Other():
mQuickStats(config.getBoolValue("quickStats")),
mWarpParticle(config.getBoolValue("warpParticle")),
mAutoShop(config.getBoolValue("autoShop")),
- mShowMobHP(config.getBoolValue("showMobHP"))
+ mShowMobHP(config.getBoolValue("showMobHP")),
+ mShowOwnHP(config.getBoolValue("showOwnHP"))
{
setName(_("Misc"));
@@ -178,6 +180,10 @@ Setup_Other::Setup_Other():
mShowMobHP,
this, ACTION_SHOW_MOB_HP);
+ mShowOwnHPCheckBox = new CheckBox(_("Show own hp bar"),
+ mShowOwnHP,
+ this, ACTION_SHOW_OWN_HP);
+
// Do the layout
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
@@ -192,6 +198,7 @@ Setup_Other::Setup_Other():
place(12, 4, mWarpParticleCheckBox, 10);
place(12, 5, mAutoShopCheckBox, 10);
place(12, 6, mShowMobHPCheckBox, 10);
+ place(12, 7, mShowOwnHPCheckBox, 10);
place(0, 3, mFloorItemsHighlightCheckBox, 12);
place(0, 4, mHighlightAttackRangeCheckBox, 12);
place(0, 5, mHighlightMonsterAttackRangeCheckBox, 12);
@@ -320,6 +327,10 @@ void Setup_Other::action(const gcn::ActionEvent &event)
{
mShowMobHP = mShowMobHPCheckBox->isSelected();
}
+ else if (event.getId() == ACTION_SHOW_OWN_HP)
+ {
+ mShowOwnHP = mShowOwnHPCheckBox->isSelected();
+ }
}
void Setup_Other::cancel()
@@ -389,6 +400,9 @@ void Setup_Other::cancel()
mShowMobHP = config.getBoolValue("showMobHP");
mShowMobHPCheckBox->setSelected(mShowMobHP);
+
+ mShowOwnHP = config.getBoolValue("showOwnHP");
+ mShowOwnHPCheckBox->setSelected(mShowOwnHP);
}
void Setup_Other::apply()
@@ -416,6 +430,7 @@ void Setup_Other::apply()
config.setValue("warpParticle", mWarpParticle);
config.setValue("autoShop", mAutoShop);
config.setValue("showMobHP", mShowMobHP);
+ config.setValue("showOwnHP", mShowOwnHP);
logger->setDebugLog(mDebugLog);
}
diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h
index b20401be5..6a092e93f 100644
--- a/src/gui/setup_other.h
+++ b/src/gui/setup_other.h
@@ -119,6 +119,9 @@ class Setup_Other : public SetupTab, public gcn::ActionListener
gcn::CheckBox *mShowMobHPCheckBox;
bool mShowMobHP;
+ gcn::CheckBox *mShowOwnHPCheckBox;
+ bool mShowOwnHP;
+
EditDialog *mEditDialog;
};
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index 03e5c1eed..46f1b72b3 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -52,6 +52,8 @@ const std::string ColorTypeNames[] =
"ColorParticle",
"ColorPickupInfo",
"ColorExpInfo",
+ "ColorPlayerHp",
+ "ColorPlayerHp2",
"ColorHitPlayerMonster",
"ColorHitMonsterPlayer",
"ColorHitPlayerPlayer",
@@ -124,6 +126,9 @@ UserPalette::UserPalette():
addColor(PARTICLE, 0xffffff, STATIC, _("Particle Effects"));
addColor(PICKUP_INFO, 0x28dc28, STATIC, _("Pickup Notification"));
addColor(EXP_INFO, 0xffff00, STATIC, _("Exp Notification"));
+ addColor(PLAYER_HP, 0x00ff00, STATIC, _("Player HP bar"), 50);
+ addColor(PLAYER_HP2, 0xff0000, STATIC,
+ _("Player HP bar (second color)"), 50);
addColor(HIT_PLAYER_MONSTER, 0x0064ff, STATIC, _("Player Hits Monster"));
addColor(HIT_MONSTER_PLAYER, 0xff3232, STATIC, _("Monster Hits Player"));
addColor(HIT_PLAYER_PLAYER, 0xff5050, STATIC,
diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h
index 057d47113..db2463e20 100644
--- a/src/gui/userpalette.h
+++ b/src/gui/userpalette.h
@@ -53,6 +53,8 @@ class UserPalette : public Palette, public gcn::ListModel
PARTICLE,
PICKUP_INFO,
EXP_INFO,
+ PLAYER_HP,
+ PLAYER_HP2,
HIT_PLAYER_MONSTER,
HIT_MONSTER_PLAYER,
HIT_PLAYER_PLAYER,
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index edff2ce67..207e71bf5 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -3344,6 +3344,7 @@ void LocalPlayer::imitateOutfit(Being *player, int sprite)
if (mImitationMode == 1 && !player_imitated.empty()
&& player->getName() == player_imitated)
{
+// logger->log("have equip %d", sprite);
// std::string filename = ItemDB::get(
// player->getId()).getSprite(mGender);
// logger->log("LocalPlayer::imitateOutfit sprite: " + toString(sprite));
@@ -3383,7 +3384,7 @@ void LocalPlayer::imitateOutfit(Being *player, int sprite)
}
else
{
-// logger->log("have unequip");
+// logger->log("have unequip %d", sprite);
int equipmentSlot = Net::getInventoryHandler()
->convertFromServerSlot(sprite);
diff --git a/src/main.h b/src/main.h
index 480c9d374..e9dd8abb2 100644
--- a/src/main.h
+++ b/src/main.h
@@ -86,8 +86,8 @@
//define DEBUG_FONT_COUNTERS 1
//define DEBUG_ALPHA_CACHE 1
-#define SMALL_VERSION "1.0.12.26"
-#define CHECK_VERSION "01.00.12.26"
+#define SMALL_VERSION "1.1.1.9"
+#define CHECK_VERSION "01.01.01.09"
#define PACKAGE_EXTENDED_VERSION "ManaPlus (" PACKAGE_OS \
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index ea4978a20..9c75689a4 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -674,6 +674,14 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
dstBeing->setSprite(SPRITE_MISC2, id);
player_node->imitateOutfit(dstBeing, SPRITE_MISC2);
break;
+ case 14:
+ dstBeing->setSprite(SPRITE_EVOL1, id);
+ player_node->imitateOutfit(dstBeing, SPRITE_EVOL1);
+ break;
+ case 15:
+ dstBeing->setSprite(SPRITE_EVOL2, id);
+ player_node->imitateOutfit(dstBeing, SPRITE_EVOL2);
+ break;
default:
logger->log("QQQ3 CHANGE_LOOKS: unsupported type: "
"%d, id: %d", type, id);
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index bdc372238..84a02e92a 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -139,12 +139,22 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_NPC_SELL_RESPONSE:
- if (msg.readInt8() == 0)
- SERVER_NOTICE(_("Thanks for selling."))
- else
- SERVER_NOTICE(_("Unable to sell."))
-
- break;
+ switch (msg.readInt8())
+ {
+ case 0:
+ SERVER_NOTICE(_("Thanks for selling."))
+ break;
+ case 1:
+ default:
+ SERVER_NOTICE(_("Unable to sell."))
+ break;
+ case 2:
+ SERVER_NOTICE(_("Unable to sell while trading."))
+ break;
+ case 3:
+ SERVER_NOTICE(_("Unable to sell unsellable item."))
+ break;
+ }
default:
break;
}
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index e500f667b..4bf9df8b3 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -160,7 +160,15 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
PlayerInfo::setCharId(msg.readInt32());
GameHandler *gh = static_cast<GameHandler*>(Net::getGameHandler());
gh->setMap(msg.readString(16));
- mapServer.hostname = ipToString(msg.readInt32());
+ if (config.getBoolValue("usePersistentIP"))
+ {
+ msg.readInt32();
+ mapServer.hostname = Client::getServerName();
+ }
+ else
+ {
+ mapServer.hostname = ipToString(msg.readInt32());
+ }
mapServer.port = msg.readInt16();
// Prevent the selected local player from being deleted
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index b4b38e623..3cc0e9ce0 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -77,8 +77,8 @@ const Equipment::Slot EQUIP_CONVERT[] =
Equipment::EQUIP_GLOVES_SLOT, // SPRITE_GLOVES
Equipment::EQUIP_FIGHT1_SLOT, // SPRITE_WEAPON
Equipment::EQUIP_FIGHT2_SLOT, // SPRITE_SHIELD
- Equipment::EQUIP_PROJECTILE_SLOT, // 0
- Equipment::EQUIP_PROJECTILE_SLOT, // 0
+ Equipment::EQUIP_EVOL_RING1_SLOT, // SPRITE_EVOL1
+ Equipment::EQUIP_EVOL_RING2_SLOT, // SPRITE_EVOL2
Equipment::EQUIP_PROJECTILE_SLOT, // 0
};
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index 73fec1322..05a28513c 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -288,7 +288,10 @@ void LoginHandler::chooseServer(unsigned int server)
return;
charServer.clear();
- charServer.hostname = ipToString(mWorlds[server]->address);
+ if (config.getBoolValue("usePersistentIP"))
+ charServer.hostname = Client::getServerName();
+ else
+ charServer.hostname = ipToString(mWorlds[server]->address);
charServer.port = mWorlds[server]->port;
Client::setState(STATE_UPDATE);
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 1d0d3e67d..8ef19c373 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -35,6 +35,7 @@
#include "gui/npcdialog.h"
#include "gui/okdialog.h"
#include "gui/sell.h"
+#include "gui/skilldialog.h"
#include "gui/statuswindow.h"
#include "gui/viewport.h"
@@ -314,6 +315,8 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
break;
case 0x000c:
PlayerInfo::setAttribute(SKILL_POINTS, value);
+ if (skillDialog)
+ skillDialog->update();
break;
case 0x0018:
if (!weightNotice)
diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h
index 6001fae3b..83854c4c6 100644
--- a/src/net/tmwa/protocol.h
+++ b/src/net/tmwa/protocol.h
@@ -59,6 +59,8 @@ enum
SPRITE_GLOVES,
SPRITE_WEAPON,
SPRITE_SHIELD,
+ SPRITE_EVOL1,
+ SPRITE_EVOL2,
SPRITE_VECTOREND
};
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 71b88d192..a590dcac1 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -69,7 +69,7 @@ void ItemDB::setStatsList(const std::list<ItemDB::Stat> &stats)
static ItemType itemTypeFromString(const std::string &name)
{
- if (name == "generic")
+ if (name == "generic" || name == "other")
{
return ITEM_UNUSABLE;
}
@@ -326,7 +326,7 @@ void ItemDB::load()
logger->log("ItemDB: Missing " #param " attribute for item %i!", \
id)
- if (id >= 0)
+ if (id >= 0 && typeStr != "other")
{
CHECK_PARAM(name, "");
CHECK_PARAM(description, "");
diff --git a/src/sound.cpp b/src/sound.cpp
index 8742ce361..080426a39 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -22,6 +22,7 @@
#include <SDL.h>
#include "configuration.h"
+#include "localplayer.h"
#include "log.h"
#include "sound.h"
@@ -280,6 +281,37 @@ void Sound::playSfx(const std::string &path)
}
}
+void Sound::playSfx(const std::string &path, int x, int y)
+{
+ if (!mInstalled || path.empty() || !mPlayBattle)
+ return;
+
+ std::string tmpPath;
+ if (!path.find("sfx/"))
+ tmpPath = path;
+ else
+ tmpPath = paths.getValue("sfx", "sfx/") + path;
+ ResourceManager *resman = ResourceManager::getInstance();
+ SoundEffect *sample = resman->getSoundEffect(tmpPath);
+ if (sample)
+ {
+ logger->log("Sound::playSfx() Playing: %s", path.c_str());
+ int vol = 120;
+ if (player_node)
+ {
+ int dx = player_node->getTileX() - x;
+ int dy = player_node->getTileY() - y;
+ if (dx < 0)
+ dx = -dx;
+ if (dy < 0)
+ dy = -dy;
+ int dist = dx > dy ? dx : dy;
+ vol -= dist * 8;
+ }
+ sample->play(0, vol);
+ }
+}
+
void Sound::playGuiSfx(const std::string &path)
{
if (!mInstalled || path.empty() || !mPlayGui)
diff --git a/src/sound.h b/src/sound.h
index 100c228c1..92c0ab41a 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -93,6 +93,8 @@ class Sound : public ConfigListener
*/
void playSfx(const std::string &path);
+ void playSfx(const std::string &path, int x, int y);
+
/**
* Plays an item for gui.
*