47#include <guichan/widgets/tabbedarea.hpp>
59 mScrollArea->setScrollPolicy(gcn::ScrollArea::SHOW_NEVER,
60 gcn::ScrollArea::SHOW_ALWAYS);
88 else if (alpha <= 200 && alpha > 100)
123 std::string::size_type pos = line.find(
" : ");
124 if (pos != std::string::npos)
126 tmp.
nick = line.substr(0, pos);
127 tmp.
text = line.substr(pos + 3);
132 if (line.substr(0, 7) ==
"Welcome")
140 tmp.
text.at(0) ==
'*' &&
141 tmp.
text.at(tmp.
text.length()-1) ==
'*')
144 tmp.
text.erase(tmp.
text.length() - 1);
148 std::string lineColor =
"##C";
152 if (tmp.
nick.empty())
154 tmp.
nick = std::string(
_(
"Global announcement:"));
175 tmp.
nick =
_(
"Server:");
199 if (tmp.
nick ==
": ")
210 std::stringstream timeStr;
211 timeStr <<
"[" << ((((t / 60) / 60) % 24 < 10) ?
"0" :
"")
212 << (
int) (((t / 60) / 60) % 24)
213 <<
":" << (((t / 60) % 60 < 10) ?
"0" :
"")
214 << (
int) ((t / 60) % 60)
217 line = lineColor + timeStr.str() + tmp.
nick + tmp.
text;
241 bool currentTab = getTabbedArea()->getSelectedTab() ==
this;
261 std::string msg = message;
268 std::string::size_type start = msg.find(
'[');
269 while (start != std::string::npos && msg[start+1] !=
'@')
271 std::string::size_type end = msg.find(
']', start);
272 if (start + 1 != end && end != std::string::npos)
276 while ((msg.find(
'[', start + 1) != std::string::npos) &&
277 (msg.find(
'[', start + 1) < end))
279 start = msg.find(
'[', start + 1);
282 std::string temp = msg.substr(start + 1, end - start - 1);
285 if (itemInfo.
id != 0)
287 msg.insert(end,
"@@");
288 msg.insert(start + 1,
"|");
290 msg.insert(start + 1,
"@@");
293 start = msg.find(
'[', start + 1);
307 scr.y =
mScrollArea->getVerticalScrollAmount() + range;
308 scr.height = abs(range);
ActorSpriteManager * actorSpriteManager
ChatLogger * chatLogger
Chat log object.
AutoCompleteLister * getPlayerNPCNameLister() const
virtual void getAutoCompleteList(std::vector< std::string > &) const
const std::string & getName() const
Returns the name of the being.
A simple browser box able to handle links and forward events to the parent conteiner.
void setOutlinedText(bool outline)
Sets whether the font will use a shadow for text.
void setShadowedText(bool shadows)
Sets whether the font will use a shadow for text.
void setMaxRows(unsigned maxRows)
Sets the maximum numbers of rows in the browser box.
void addRow(std::string_view row)
Adds a text row to the browser.
void setLinkHandler(LinkHandler *handler)
Sets the handler for links.
void clearRows()
Remove all rows.
@ AUTO_WRAP
Maybe it needs a fix or to be redone.
void setWrapIndent(int indent)
Sets the wrap indent for the browser box.
void log(std::string str)
Enters a message in the log.
void chatLog(std::string line, Own own=BY_SERVER, bool ignoreRecord=false)
Adds a line of text to our message list.
ChatTab(const std::string &name)
virtual void handleInput(const std::string &msg)
virtual bool handleCommand(const std::string &type, const std::string &args)
Handle special commands.
void updateTextFormat(int alpha)
Adapts the text format to the current gui opacity, for better readability.
virtual void saveToLogFile(std::string &msg)
void scroll(int amount)
Scrolls the chat window.
void getAutoCompleteList(std::vector< std::string > &names) const override
void event(Event::Channel channel, const Event &event) override
void chatInput(const std::string &msg)
Determines whether the message is a command or message, then sends the given message to the game serv...
void clearText()
Clears the text from the tab.
virtual bool checkNotify(Own own) const
Returns whether a notify sound may be played for the given type of message.
ItemLinkHandler * mItemLinkHandler
Used for showing item popup on clicking links.
void removeTab(ChatTab *tab)
Remove the given tab from the window.
void addTab(ChatTab *tab)
Add the tab to the window.
static bool hasInputFocus()
void handleCommand(const std::string &command, ChatTab *tab=localChatTab)
Parse and handle the given command.
void listen(Event::Channel channel)
const ItemInfo & get(int id) const
Defines a class for storing generic item infos.
virtual void talk(const std::string &text)=0
void record(const std::string &msg)
Outputs the message to the recorder file.
void playNotification(const std::string &path)
Plays a sound on the notification channel.
void setCaption(const std::string &caption)
Sets the caption of the tab.
void setFlash(bool flash)
Set tab flashing state.
static int getGuiAlpha()
Gets the alpha value used by the window, in a Guichan usable format.
Config config
Global settings (config.xml)
ItemDB * itemDb
Items info database.
CommandHandler * commandHandler
LocalPlayer * local_player
ChatHandler * getChatHandler()
std::string strprintf(char const *format,...)
A safe version of sprintf that returns a std::string of the result.
std::string & trim(std::string &str)
Trims spaces off the end and the beginning of the given string.
std::string toString(const T &arg)
Converts the given value to a string using std::stringstream.
One item in the chat log.