diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commandhandler.cpp | 74 | ||||
-rw-r--r-- | src/commandhandler.h | 11 | ||||
-rw-r--r-- | src/graphics.cpp | 4 | ||||
-rw-r--r-- | src/graphics.h | 16 | ||||
-rw-r--r-- | src/gui/chatwindow.cpp | 3 | ||||
-rw-r--r-- | src/localplayer.cpp | 5 | ||||
-rw-r--r-- | src/logger.h | 2 | ||||
-rw-r--r-- | src/main.h | 4 | ||||
-rw-r--r-- | src/net/chathandler.h | 4 | ||||
-rw-r--r-- | src/net/ea/chathandler.cpp | 45 | ||||
-rw-r--r-- | src/net/ea/chathandler.h | 2 | ||||
-rw-r--r-- | src/net/ea/tradehandler.cpp | 8 | ||||
-rw-r--r-- | src/net/manaserv/chathandler.h | 4 | ||||
-rw-r--r-- | src/net/messageout.cpp | 28 | ||||
-rw-r--r-- | src/net/messageout.h | 7 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 17 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/messageout.h | 3 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/protocol.h | 2 | ||||
-rw-r--r-- | src/opengl1graphics.cpp | 1 | ||||
-rw-r--r-- | src/openglgraphics.cpp | 1 | ||||
-rw-r--r-- | src/resources/image.h | 3 | ||||
-rw-r--r-- | src/resources/itemdb.cpp | 35 |
25 files changed, 270 insertions, 21 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index f1b7518c5..cac12b8ec 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -26,6 +26,7 @@ #include "actorspritemanager.h" #include "channelmanager.h" #include "channel.h" +#include "configuration.h" #include "game.h" #include "guildmanager.h" #include "localplayer.h" @@ -190,6 +191,12 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) handleAddIgnoreAttack(args, tab); else if (type == "dump") handleDump(args, tab); + else if (type == "serverignoreall") + handleServerIgnoreAll(args, tab); + else if (type == "serverunignoreall") + handleServerUnIgnoreAll(args, tab); + else if (type == "dumpg") + handleDumpGraphics(args, tab); else if (tab->handleCommand(type, args)) ; else if (type == "hack") @@ -373,13 +380,19 @@ void CommandHandler::handleParty(const std::string &args, ChatTab *tab) void CommandHandler::handleMe(const std::string &args, ChatTab *tab) { + const std::string str = strprintf("*%s*", args.c_str()); + outString(tab, strprintf("*%s*", args.c_str()), args); +} + +void CommandHandler::outString(ChatTab *tab, const std::string &str, + const std::string &def) +{ if (!tab) { - Net::getChatHandler()->me(args); + Net::getChatHandler()->me(def); return; } - const std::string str = strprintf("*%s*", args.c_str()); switch (tab->getType()) { case ChatTab::TAB_PARTY: @@ -402,7 +415,7 @@ void CommandHandler::handleMe(const std::string &args, ChatTab *tab) break; } default: - Net::getChatHandler()->me(args); + Net::getChatHandler()->me(def); break; } } @@ -1020,6 +1033,60 @@ void CommandHandler::handleCacheInfo(const std::string &args A_UNUSED, #endif } +void CommandHandler::handleServerIgnoreAll(const std::string &args, + ChatTab *tab A_UNUSED) +{ + Net::getChatHandler()->ignoreAll(); +} + +void CommandHandler::handleServerUnIgnoreAll(const std::string &args, + ChatTab *tab A_UNUSED) +{ + Net::getChatHandler()->unIgnoreAll(); +} + +void CommandHandler::handleDumpGraphics(const std::string &args, ChatTab *tab) +{ + std::string str; + str = strprintf ("%s,%s,%dX%dX%d,", PACKAGE_OS, SMALL_VERSION, + mainGraphics->getWidth(), mainGraphics->getHeight(), + mainGraphics->getBpp()); + + if (mainGraphics->getFullScreen()) + str += "F"; + else + str += "W"; + if (mainGraphics->getHWAccel()) + str += "H"; + else + str += "S"; + + if (mainGraphics->getDoubleBuffer()) + str += "D"; + else + str += "_"; + +#if defined USE_OPENGL + str += strprintf(",%d", mainGraphics->getOpenGL()); +#else + str += ",0"; +#endif + + str += strprintf(",%f,", Client::getGuiAlpha()); + str += config.getBoolValue("adjustPerfomance") ? "1" : "0"; + str += config.getBoolValue("alphaCache") ? "1" : "0"; + str += config.getBoolValue("enableMapReduce") ? "1" : "0"; + str += config.getBoolValue("beingopacity") ? "1" : "0"; + str += ","; + str += config.getBoolValue("enableAlphaFix") ? "1" : "0"; + str += config.getBoolValue("disableAdvBeingCaching") ? "1" : "0"; + str += config.getBoolValue("disableBeingCaching") ? "1" : "0"; + str += config.getBoolValue("particleeffects") ? "1" : "0"; + + str += strprintf(",%d-%d", fps, config.getIntValue("fpslimit")); + outString(tab, str, str); +} + #ifdef DEBUG_DUMP_LEAKS void showRes(std::string str, ResourceManager::Resources *res); @@ -1076,6 +1143,7 @@ void CommandHandler::handleDump(const std::string &args, + toString(res->size())); } } + #elif defined ENABLE_MEM_DEBUG void CommandHandler::handleDump(const std::string &args A_UNUSED, ChatTab *tab A_UNUSED) diff --git a/src/commandhandler.h b/src/commandhandler.h index 52080dfcd..0b3146af8 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -290,8 +290,19 @@ class CommandHandler void handleAddIgnoreAttack(const std::string &args, ChatTab *tab A_UNUSED); + void handleServerIgnoreAll(const std::string &args, + ChatTab *tab A_UNUSED); + + void handleServerUnIgnoreAll(const std::string &args, + ChatTab *tab A_UNUSED); + void handleDump(const std::string &args, ChatTab *tab); + void handleDumpGraphics(const std::string &args, ChatTab *tab); + + void outString(ChatTab *tab, const std::string &str, + const std::string &def); + void handleCacheInfo(const std::string &args, ChatTab *tab A_UNUSED); bool parse2Int(const std::string &args, int *x, int *y); diff --git a/src/graphics.cpp b/src/graphics.cpp index efa1058a6..d914b0b00 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -53,6 +53,7 @@ Graphics::Graphics(): mRect.y = 0; mRect.w = 0; mRect.h = 0; + mOpenGL = 0; } Graphics::~Graphics() @@ -100,7 +101,10 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) logger->log("Double buffer mode: %s", mDoubleBuffer ? "yes" : "no"); if (mTarget->format) + { logger->log("Bits per pixel: %d", mTarget->format->BytesPerPixel); + bpp = mTarget->format->BytesPerPixel; + } const SDL_VideoInfo *vi = SDL_GetVideoInfo(); if (!vi) diff --git a/src/graphics.h b/src/graphics.h index f3e0bd05d..4a4676b26 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -275,6 +275,21 @@ class Graphics : public gcn::SDLGraphics bool getSecure() { return mSecure; } + int getBpp() + { return mBpp; } + + bool getFullScreen() + { return mFullscreen; } + + bool getHWAccel() + { return mHWAccel; } + + bool getDoubleBuffer() + { return mDoubleBuffer; } + + int getOpenGL() + { return mOpenGL; } + int mWidth; int mHeight; @@ -290,6 +305,7 @@ class Graphics : public gcn::SDLGraphics bool mDoubleBuffer; SDL_Rect mRect; bool mSecure; + int mOpenGL; }; extern Graphics *mainGraphics; diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 59bd173bd..7969f55f8 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -294,6 +294,9 @@ void ChatWindow::fillCommands() mCommands.push_back("/removeattack "); mCommands.push_back("/addignoreattack "); mCommands.push_back("/blacklist "); + mCommands.push_back("/serverignoreall"); + mCommands.push_back("/serverunignoreall"); + mCommands.push_back("/dumpg"); } void ChatWindow::resetToDefaultSize() diff --git a/src/localplayer.cpp b/src/localplayer.cpp index f33a72bb0..58edbfd78 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -3779,8 +3779,11 @@ void LocalPlayer::fixAttackTarget() if (!mMap || !mTarget) return; - if (!getAttackType() || !config.getBoolValue("autofixPos")) + if (getMoveToTargetType() == 7 || !getAttackType() + || !config.getBoolValue("autofixPos")) + { return; + } const Vector &playerPos = getPosition(); Path debugPath = mMap->findPath( diff --git a/src/logger.h b/src/logger.h index c2fabb383..4ce89f759 100644 --- a/src/logger.h +++ b/src/logger.h @@ -29,7 +29,7 @@ class ChatWindow; #ifdef ENABLEDEBUGLOG -#define DEBUGLOG(msg) logger->dlog(msg) +#define DEBUGLOG(msg) if (logger) logger->dlog(msg) #else #define DEBUGLOG(msg) {} #endif diff --git a/src/main.h b/src/main.h index 548c3283f..63db481a5 100644 --- a/src/main.h +++ b/src/main.h @@ -45,8 +45,8 @@ * different interfaces, which have different implementations for each server. */ -#define SMALL_VERSION "1.1.10.16" -#define CHECK_VERSION "01.01.10.16" +#define SMALL_VERSION "1.1.10.30" +#define CHECK_VERSION "01.01.10.30" #ifdef HAVE_CONFIG_H #include "../config.h" diff --git a/src/net/chathandler.h b/src/net/chathandler.h index a0e232027..fc6c10376 100644 --- a/src/net/chathandler.h +++ b/src/net/chathandler.h @@ -64,6 +64,10 @@ class ChatHandler virtual void who() = 0; virtual void sendRaw(const std::string &args) = 0; + + virtual void ignoreAll() = 0; + + virtual void unIgnoreAll() = 0; }; } diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 60af645be..35e8597f0 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -353,4 +353,49 @@ void ChatHandler::processMVP(Net::MessageIn &msg) } } +void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) +{ + int action = msg.readInt8(); + int fail = msg.readInt8(); + if (!localChatTab) + return; + + switch (action) + { + case 0: + { + switch (fail) + { + case 0: + localChatTab->chatLog(_("All whispers ignored."), + BY_SERVER); + break; + default: + localChatTab->chatLog(_("All whispers ignore failed."), + BY_SERVER); + break; + } + break; + } + case 1: + { + switch (fail) + { + case 0: + localChatTab->chatLog(_("All whispers unignored."), + BY_SERVER); + break; + default: + localChatTab->chatLog(_("All whispers unignore failed."), + BY_SERVER); + break; + } + break; + } + default: + // unknown result + break; + } +} + } // namespace Ea diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h index d000b673d..cff9bf589 100644 --- a/src/net/ea/chathandler.h +++ b/src/net/ea/chathandler.h @@ -84,6 +84,8 @@ class ChatHandler : public Net::ChatHandler virtual void processMVP(Net::MessageIn &msg); + virtual void processIgnoreAllResponse(Net::MessageIn &msg); + protected: typedef std::queue<std::string> WhisperQueue; WhisperQueue mSentWhispers; diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index bdbba9715..19aa474e3 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -121,6 +121,14 @@ void TradeHandler::processTradeRequest(Net::MessageIn &msg) void TradeHandler::processTradeResponse(Net::MessageIn &msg) { + if (confirmDlg || tradePartnerName.empty() + || !player_relations.hasPermission(tradePartnerName, + PlayerRelation::TRADE)) + { + Net::getTradeHandler()->respond(false); + return; + } + switch (msg.readInt8()) { case 0: // Too far away diff --git a/src/net/manaserv/chathandler.h b/src/net/manaserv/chathandler.h index 5eb2a0ff4..beea40423 100644 --- a/src/net/manaserv/chathandler.h +++ b/src/net/manaserv/chathandler.h @@ -133,6 +133,10 @@ class ChatHandler : public MessageHandler, public Net::ChatHandler * Handle who responses. */ void handleWhoResponse(Net::MessageIn &msg); + + void ignoreAll() + + void unIgnoreAll() }; } // namespace ManaServ diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index a8b66f5ae..f18f65a93 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -82,6 +82,34 @@ void MessageOut::writeString(const std::string &string, int length) PacketCounters::incOutBytes(length); } +void MessageOut::writeStringNoLog(const std::string &string, int length) +{ + DEBUGLOG("writeString: ***"); + int stringLength = static_cast<int>(string.length()); + if (length < 0) + { + // Write the length at the start if not fixed + writeInt16(static_cast<short>(stringLength)); + length = stringLength; + } + else if (length < stringLength) + { + // Make sure the length of the string is no longer than specified + stringLength = length; + } + expand(length); + + // Write the actual string + memcpy(mData + mPos, string.c_str(), stringLength); + + // Pad remaining space with zeros + if (length > stringLength) + memset(mData + mPos + stringLength, '\0', length - stringLength); + + mPos += length; + PacketCounters::incOutBytes(length); +} + char *MessageOut::getData() const { return mData; diff --git a/src/net/messageout.h b/src/net/messageout.h index 39a2e68bd..4445bbbe8 100644 --- a/src/net/messageout.h +++ b/src/net/messageout.h @@ -57,6 +57,13 @@ class MessageOut virtual void writeString(const std::string &string, int length = -1); /** + * Writes a string. If a fixed length is not given (-1), it is stored + * as a short at the start of the string. + */ + virtual void writeStringNoLog(const std::string &string, + int length = -1); + + /** * Returns the content of the message. */ virtual char *getData() const; diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 4e4318595..fe6592d93 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -60,6 +60,7 @@ ChatHandler::ChatHandler() SMSG_WHISPER_RESPONSE, SMSG_GM_CHAT, SMSG_MVP, // MVP + SMSG_IGNORE_ALL_RESPONSE, 0 }; handledMessages = _messages; @@ -96,6 +97,9 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) processMVP(msg); break; + case SMSG_IGNORE_ALL_RESPONSE: + processIgnoreAllResponse(msg); + default: break; } @@ -249,5 +253,16 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line) } } -} // namespace TmwAthena +void ChatHandler::ignoreAll() +{ + MessageOut outMsg(CMSG_IGNORE_ALL); + outMsg.writeInt8(0); +} +void ChatHandler::unIgnoreAll() +{ + MessageOut outMsg(CMSG_IGNORE_ALL); + outMsg.writeInt8(1); +} + +} // namespace TmwAthena diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h index d9e927e03..197ba12b3 100644 --- a/src/net/tmwa/chathandler.h +++ b/src/net/tmwa/chathandler.h @@ -57,6 +57,10 @@ class ChatHandler : public MessageHandler, public Ea::ChatHandler void sendRaw(const std::string &args); + void ignoreAll(); + + void unIgnoreAll(); + void processRaw(MessageOut &outMsg, std::string &line); }; diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index cac8df623..bdc944d63 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -118,8 +118,8 @@ void LoginHandler::changePassword(const std::string &username A_UNUSED, const std::string &newPassword) { MessageOut outMsg(CMSG_CHAR_PASSWORD_CHANGE); - outMsg.writeString(oldPassword, 24); - outMsg.writeString(newPassword, 24); + outMsg.writeStringNoLog(oldPassword, 24); + outMsg.writeStringNoLog(newPassword, 24); } void LoginHandler::sendLoginRegister(const std::string &username, @@ -128,7 +128,7 @@ void LoginHandler::sendLoginRegister(const std::string &username, MessageOut outMsg(0x0064); outMsg.writeInt32(0); // client version outMsg.writeString(username, 24); - outMsg.writeString(password, 24); + outMsg.writeStringNoLog(password, 24); /* * eAthena calls the last byte "client version 2", but it isn't used at diff --git a/src/net/tmwa/messageout.h b/src/net/tmwa/messageout.h index da86f06f6..d97851d4a 100644 --- a/src/net/tmwa/messageout.h +++ b/src/net/tmwa/messageout.h @@ -56,6 +56,9 @@ class MessageOut : public Net::MessageOut void writeCoordinates(unsigned short x, unsigned short y, unsigned char direction); + void resetPos() + { mPos = 0; } + private: void expand(size_t size); diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 0af74c295..e26f48324 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -260,6 +260,7 @@ void Network::flush() SDL_mutexP(mMutex); ret = SDLNet_TCP_Send(mSocket, mOutBuffer, mOutSize); + DEBUGLOG("Send " + toString(mOutSize) + " bytes"); if (ret < static_cast<int>(mOutSize)) { setError("Error in SDLNet_TCP_Send(): " + @@ -427,6 +428,7 @@ void Network::receive() } else { + DEBUGLOG("Receive " + toString(ret) + " bytes"); mInSize += ret; if (mToSkip) { diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h index 3a753e351..caf3c8e53 100644 --- a/src/net/tmwa/protocol.h +++ b/src/net/tmwa/protocol.h @@ -331,5 +331,7 @@ enum #define SMSG_BEING_IP_RESPONSE 0x020c #define SMSG_PVP_MAP_MODE 0x0199 #define SMSG_PVP_SET 0x019a +#define CMSG_IGNORE_ALL 0x00d0 +#define SMSG_IGNORE_ALL_RESPONSE 0x00d2 #endif diff --git a/src/opengl1graphics.cpp b/src/opengl1graphics.cpp index 46e482df6..1f1a0231d 100644 --- a/src/opengl1graphics.cpp +++ b/src/opengl1graphics.cpp @@ -49,6 +49,7 @@ OpenGL1Graphics::OpenGL1Graphics(): mAlpha(false), mTexture(false), mColorAlpha(false), mSync(false) { + mOpenGL = 2; } OpenGL1Graphics::~OpenGL1Graphics() diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 2ec5db490..049556c76 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -53,6 +53,7 @@ OpenGLGraphics::OpenGLGraphics(): mAlpha(false), mTexture(false), mColorAlpha(false), mSync(false) { + mOpenGL = 1; mFloatTexArray = new GLfloat[vertexBufSize * 4 + 30]; mIntTexArray = new GLint[vertexBufSize * 4 + 30]; mIntVertArray = new GLint[vertexBufSize * 4 + 30]; diff --git a/src/resources/image.h b/src/resources/image.h index 9ac2b163e..941b34465 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -188,6 +188,9 @@ class Image : public Resource static void SDLSetEnableAlphaCache(bool n) { mEnableAlphaCache = n; } + static bool SDLGetEnableAlphaCache() + { return mEnableAlphaCache; } + static void setEnableAlpha(bool n) { mEnableAlpha = n; } diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 9ff80de22..74474e067 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -636,19 +636,20 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) { case -1: { - for_each_xml_child_node(itemNode, replaceNode) + for (int f = 0; f < 9; f ++) { - if (xmlStrEqual(itemNode->name, BAD_CAST "item")) + std::map<int, int> *mapList + = itemInfo->addReplaceSprite( + parseSpriteName(removeSprite), f); + if (!mapList) + continue; + for_each_xml_child_node(itemNode, replaceNode) { - int from = XML::getProperty(itemNode, "from", 0); - int to = XML::getProperty(itemNode, "to", 1); - for (int f = 0; f < 9; f ++) + if (xmlStrEqual(itemNode->name, BAD_CAST "item")) { - std::map<int, int> *mapList - = itemInfo->addReplaceSprite( - parseSpriteName(removeSprite), f); - if (!mapList) - continue; + int from = XML::getProperty(itemNode, "from", 0); + int to = XML::getProperty(itemNode, "to", 1); + (*mapList)[from] = to; } } @@ -657,6 +658,13 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) } case -2: { + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_DOWN); + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_DOWNLEFT); + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_DOWNRIGHT); + for_each_xml_child_node(itemNode, replaceNode) { if (xmlStrEqual(itemNode->name, BAD_CAST "item")) @@ -683,6 +691,13 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) } case -3: { + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_UP); + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_UPLEFT); + itemInfo->addReplaceSprite(parseSpriteName( + removeSprite), DIRECTION_UPRIGHT); + for_each_xml_child_node(itemNode, replaceNode) { if (xmlStrEqual(itemNode->name, BAD_CAST "item")) |