78 #if defined USE_OPENGL
109 #include "utils/timer.h"
118 PRAGMA48(GCC diagnostic ignored
"-Wshadow")
121 #include <SDL_screenkeyboard.h>
158 const size_t sz = str.size();
161 if (str[sz - 1] ==
'\n')
162 str = str.substr(0, sz - 1);
163 str.append(
info->addStr);
169 info->text.c_str(), str.c_str(), str.c_str());
189 info->upload =
nullptr;
196 const std::string &addStr,
204 info->upload = upload;
206 info->addStr = addStr;
217 Being *being =
nullptr;
228 if ((being ==
nullptr) && npc)
232 if (being !=
nullptr)
241 if ((being ==
nullptr) && npc)
245 if (being !=
nullptr)
296 std::string str =
event.args;
307 amount = item->
getQuantity() - atoi(str.substr(1).c_str());
316 else if (str ==
"all")
322 amount = atoi(str.c_str());
474 Item *
const item = inv->
findItem(atoi(event.args.c_str()),
510 Item *
const item = inv->
findItem(atoi(event.args.c_str()),
535 std::string args =
event.args;
539 const Being *being =
nullptr;
543 args.substr(1).c_str()),
BeingId));
551 if (being !=
nullptr)
559 if (target ==
nullptr ||
568 if (target ==
nullptr)
596 int maxHealingRadius;
602 maxHealingRadius = matk / 100 + 1;
606 maxHealingRadius = (12 *
fastSqrtInt(matk) + matk) / 100 + 1;
610 if (target !=
nullptr)
682 const std::string args =
event.args;
730 const std::string args =
event.args;
736 const std::set<std::string> &players =
738 if (players.find(args) != players.end())
748 if (being ==
nullptr)
751 if (being ==
nullptr)
781 const std::string args =
event.args;
783 if (being ==
nullptr &&
788 const std::set<std::string> &players =
790 if (players.find(args) != players.end())
800 if (being ==
nullptr)
803 if (being ==
nullptr)
830 const std::string args =
event.args;
831 Being *being =
nullptr;
833 if (!args.empty() && args[0] ==
':')
836 args.substr(1).c_str()),
BeingId));
843 if (being ==
nullptr)
886 Being *target =
nullptr;
887 std::string args =
event.args;
898 args.substr(1).c_str()),
BeingId));
899 if (target !=
nullptr &&
906 if (target ==
nullptr)
910 if (target !=
nullptr)
919 Being *target =
nullptr;
920 std::string args =
event.args;
934 args.substr(1).c_str()),
BeingId));
935 if (target !=
nullptr &&
946 if (target ==
nullptr)
964 if (target !=
nullptr)
999 #if defined(ANDROID) || defined(__SWITCH__)
1001 if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE)
1002 SDL_StopTextInput();
1004 SDL_StartTextInput();
1007 SDL_ANDROID_ToggleScreenKeyboardTextInput(
nullptr);
1089 std::ostringstream
where;
1144 if (being ==
nullptr)
1146 if (being !=
nullptr)
1250 const std::string args =
event.args;
1254 Being *target =
nullptr;
1255 const size_t sz = pars.size();
1262 if (pars[0][0] ==
':')
1265 pars[0].substr(1).c_str()),
BeingId));
1278 if (target !=
nullptr)
1280 const int itemId = atoi(pars[1].c_str());
1346 #ifdef DEBUG_DUMP_LEAKS1
1363 while (iter != iter_end)
1365 if (iter->second && iter->second->mRefCount)
1369 if (iter->second->getDumped())
1372 iter->second->setDumped(
true);
1376 Image *
const image =
dynamic_cast<Image *
>(iter->second);
1383 id = image->getGLImage();
1384 logger->
log(
"Resource %c%c: %s (%d) id=%d", type,
1385 isNew, iter->second->getIdPath().c_str(),
1386 iter->second->mRefCount, id);
1397 if (!event.args.empty())
1401 showRes(
_(
"Resource images:"), res);
1402 res = ResourceManager::getOrphanedResources();
1404 showRes(
_(
"Orphaned resource images:"), res);
1414 res = ResourceManager::getOrphanedResources();
1425 #elif defined ENABLE_MEM_DEBUG
1454 PRAGMA6(GCC diagnostic ignored
"-Wnull-dereference")
1457 int *
const ptr =
nullptr;
1484 #if defined USE_OPENGL
1509 for (
char **env =
environ; *env !=
nullptr; ++ env)
1533 #if !defined(ANDROID) && !defined(__native_client__) && !defined(__SWITCH__)
1564 #if defined USE_OPENGL && defined DEBUG_SDLFONT
1567 Font *font =
new Font(
"fonts/dejavusans.ttf", 18, TTF_STYLE_NORMAL);
1571 STD_VECTOR<std::string>
data;
1572 volatile int width = 0;
1574 for (
int f = 0; f < 300; f ++)
1578 clock_gettime(CLOCK_MONOTONIC, &time1);
1579 Color color(0, 0, 0, 255);
1581 for (
int f = 0; f < 500; f ++)
1583 FOR_EACH (STD_VECTOR<std::string>::const_iterator, it,
data)
1586 font->
drawString(nullGraphics, color, color, *it, 10, 10);
1588 FOR_EACH (STD_VECTOR<std::string>::const_iterator, it,
data)
1589 font->
drawString(nullGraphics, color, color, *it, 10, 10);
1594 clock_gettime(CLOCK_MONOTONIC, &time2);
1596 delete nullGraphics;
1599 int64_t diff = (
static_cast<long long int>(
1600 time2.tv_sec) * 1000000000LL +
static_cast<long long int>(
1601 time2.tv_nsec)) / 100000 - (
static_cast<long long int>(
1602 time1.tv_sec) * 1000000000LL +
static_cast<long long int>(
1603 time1.tv_nsec)) / 100000;
1619 FOR_EACH (ItemDB::ItemInfos::const_iterator, it, items)
1622 if (
info ==
nullptr)
1624 const int id =
info->getId();
1716 const int sz =
CAST_S32(pars.size());
1720 const int itemId = atoi(pars[0].c_str());
1728 int16_t useType = 0;
1732 const int sz2 =
CAST_S32(pars2.size());
1738 useType =
CAST_S16(atoi(pars[1].c_str()));
1763 const std::string args =
event.args;
1781 Item *item =
nullptr;
1784 if (item ==
nullptr)
1809 Item *item =
nullptr;
1833 Item *item =
nullptr;
1858 const int id = atoi(event.args.c_str());
1866 const int id = atoi(event.args.c_str());
1877 Being *target =
nullptr;
1878 std::string args =
event.args;
1889 args.substr(1).c_str()),
BeingId));
1892 if (target ==
nullptr)
1920 if (slot >= 0 && slot < 9)
1960 tab->
chatLog(
_(
"Last seen disabled. "
1961 "Enable in players / collect players ID and seen log."),
1968 const std::string name =
event.args;
1978 if (lines.size() < 3)
1981 tab->
chatLog(
_(
"You have never seen this nick."),
1989 _(
"Last seen for %s: %s"),
2000 tab->
chatLog(
_(
"You have not seen this nick before."),
2011 if (event.tab !=
nullptr)
2020 const std::string &args =
event.args;
2021 if (args ==
"player" || args.empty())
2025 else if (args ==
"pet")
2029 else if (args ==
"homun" || args ==
"homunculus")
2033 else if (args ==
"merc" || args ==
"mercenary")
#define impHandler0(name)
ActorManager * actorManager
Net::AdminHandler * adminHandler
const bool AllowSort_true
Net::BeingHandler * beingHandler
#define fromBool(val, name)
Net::BuyingStoreHandler * buyingStoreHandler
Net::BuySellHandler * buySellHandler
Net::ChatHandler * chatHandler
void outStringNormal(ChatTab *const tab, const std::string &str, const std::string &def)
Being * findNearestLivingBeing(const int x, const int y, int maxTileDist, const ActorTypeT type, const Being *const excluded) const
Being * findMostDamagedPlayer(const int maxTileDist) const
Being * findBeing(const BeingId id) const
Being * findNearestPvpPlayer() const
void heal(const Being *const target) const
Being * findBeingByName(const std::string &name, const ActorTypeT type) const
FloorItem * findItem(const BeingId id) const
Being * findNearestByName(const std::string &name, const ActorTypeT &type) const
virtual int getPixelY() const
void undressItemById(const int id)
const std::string & getName() const
ActorTypeT getType() const
ShopItem * addItem(const int id, const ItemTypeT type, const ItemColor color, const int amount, const int price)
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
bool isTabPresent(const ChatTab *const tab) const
void addInputText(const std::string &text, const bool space)
std::string getValue(const std::string &key, const std::string &deflt) const
bool getBoolValue(const std::string &key) const
std::string getStringValue(const std::string &key) const
std::string getFileName() const
int getIntValue(const std::string &key) const
void dropItems(const int cnt)
void useEmotePlayer(const size_t index) const
int getWidth(const std::string &text) const
void drawString(Graphics *const graphics, Color col, const Color &col2, const std::string &text, const int x, const int y)
static void resetModifiers()
static bool createScreenshot(const std::string &prefix)
const std::string & getCurrentMapName() const
std::string getGLVersion() const
RenderType getOpenGL() const
bool getDoubleBuffer() const
bool getFullScreen() const
static uint8_t getMouseState(int &x, int &y)
unsigned short getPort() const
void moveItemToCraft(const int craftSlot)
Item * getItem(const int index) const
Item * findItem(const int itemId, const ItemColor color) const
static void showWindow(const ItemAmountWindowUsageT usage, Window *const parent, Item *const item, int maxRange, const int tag)
void useItem(const size_t index) const
void attack2(Being *const target, const bool keep, const bool dontChangeEquipment)
bool pickUpItems(int pickUpType)
void setTarget(Being *const target)
Being * getTarget() const
void attack(Being *const target, const bool keep, const bool dontChangeEquipment)
void stopAttack(const bool keepAttack)
bool pickUp(FloorItem *const item)
void log(const char *const log_text,...)
void log1(const char *const log_text)
static void printAllMemory(ChatTab *const tab)
virtual void createItems(const int id, const ItemColor color, const int amount) const =0
virtual void kick(const BeingId playerId) const =0
virtual void undress(Being *const being) const =0
virtual void requestSellList(const std::string &nick) const =0
virtual void requestBuyList(const std::string &nick) const =0
virtual void open(const Being *const being) const =0
virtual void unIgnoreAll() const =0
virtual void ignoreAll() const =0
virtual void who() const =0
void setFile(const std::string &filename, const int64_t adler32)
static std::string getUploadResponse()
virtual void disconnect2() const =0
virtual void moveToMaster() const =0
virtual void feed() const =0
virtual void moveItem2(const InventoryTypeT source, const int slot, const int amount, const InventoryTypeT destination) const =0
virtual void moveToMaster() const =0
virtual void fire() const =0
virtual void buy(const Being *const being) const =0
virtual void sell(const BeingId beingId) const =0
virtual bool canUseMagic() const =0
virtual void request(const Being *const being) const
virtual void open(const Being *const being) const =0
static NpcDialog * getActive()
void wearOutfit(const int outfit, const bool unwearEmpty, const bool select)
void copyOutfit(const int outfit)
unsigned int targetingType
std::string screenshotDir
void action(const ActionEvent &event)
void clear(const bool isSave)
void useItem(const int itemId, const AutoTarget autoTarget, const int level, const std::string &data) const
void useItem(const int itemId) const
void tradeItem(const Item *const item, const int quantity, const bool check) const
const std::set< std::string > & getOnlineNicks() const
virtual void setVisible(Visible visible)
bool isWindowVisible() const
Configuration serverConfig
const unsigned int SHORTCUT_TABS
static const int mapTileSize
DownloadStatus ::T DownloadStatusT
DropShortcut * dropShortcut
EmoteShortcut * emoteShortcut
#define FOR_EACH(type, iter, array)
Net::GameHandler * gameHandler
GraphicsManager graphicsManager
Net::HomunculusHandler * homunculusHandler
const bool IgnoreRecord_false
#define fromInt(val, name)
Net::InventoryHandler * inventoryHandler
InventoryType ::T InventoryTypeT
InventoryWindow * inventoryWindow
InventoryWindow * storageWindow
const ItemColor ItemColor_one
ItemShortcut * itemShortcut[SHORTCUT_TABS]
LocalPlayer * localPlayer
std::string tradePartnerName
int fastSqrtInt(const unsigned int n)
Net::MercenaryHandler * mercenaryHandler
bool kick(InputEvent &event)
bool dumpGL(InputEvent &event)
bool uploadConfig(InputEvent &event)
bool where(InputEvent &event)
bool serverUnIgnoreAll(InputEvent &event)
bool quit(InputEvent &event)
bool cleanFonts(InputEvent &event)
bool cacheInfo(InputEvent &event)
bool undress(InputEvent &event)
bool craftKey(InputEvent &event)
bool dumpMods(InputEvent &event)
bool dropItemIdAll(InputEvent &event)
bool dumpMemoryUsage(InputEvent &event)
bool dumpOGL(InputEvent &event)
bool serverIgnoreAll(InputEvent &event)
bool untarget(InputEvent &event)
static int uploadUpdate(void *ptr, const DownloadStatusT status, size_t total, const size_t remaining)
bool heal(InputEvent &event)
bool shortcut(InputEvent &event)
static Item * getItemByInvIndex(const int index, const InventoryTypeT invType)
bool copyEquippedToOutfit(InputEvent &event)
bool ipcToggle(InputEvent &event)
bool stopAttack(InputEvent &event)
bool seen(InputEvent &event)
bool ignoreInput(InputEvent &event)
bool mouseClick(InputEvent &event)
bool openTrade(InputEvent &event)
bool uploadLog(InputEvent &event)
bool mercenaryToMaster(InputEvent &event)
bool buy(InputEvent &event)
bool priceLoad(InputEvent &event)
bool resetGameModifiers(InputEvent &event)
bool targetAttack(InputEvent &event)
bool who(InputEvent &event)
bool testInfo(InputEvent &event)
bool screenshot(InputEvent &event)
bool clearDrop(InputEvent &event)
bool talk(InputEvent &event)
bool attackHuman(InputEvent &event)
bool dirs(InputEvent &event)
static void uploadFile(const std::string &str, const std::string &fileName, const std::string &addStr, ChatTab *const tab)
bool cleanGraphics(InputEvent &event)
bool storageToInv(InputEvent &event)
bool useItemInv(InputEvent &event)
bool outfit(InputEvent &event)
bool setHome(InputEvent &event)
bool uploadServerConfig(InputEvent &event)
bool dumpGraphics(InputEvent &event)
bool showKeyboard(InputEvent &event)
bool setEmoteType(InputEvent &event)
bool invToStorage(InputEvent &event)
bool itenplz(InputEvent &event)
bool homunculusFeed(InputEvent &event)
bool dumpTests(InputEvent &event)
bool dropItem0(InputEvent &event)
bool dropItemInvAll(InputEvent &event)
bool attack(InputEvent &event)
bool healmd(InputEvent &event)
bool stopSit(InputEvent &event)
static Being * findBeing(const std::string &name, const bool npc)
bool uptime(InputEvent &event)
bool safeVideoMode(InputEvent &event)
static int getAmountFromEvent(const InputEvent &event, Item *&item0, const InventoryTypeT invType)
bool showWindows(InputEvent &event)
bool sell(InputEvent &event)
bool trade(InputEvent &event)
bool unprotectItem(InputEvent &event)
bool priceSave(InputEvent &event)
bool error(InputEvent &event) __attribute__((noreturn))
bool magicAttack(InputEvent &event)
bool mercenaryFire(InputEvent &event)
bool ok(InputEvent &event)
bool emote(InputEvent &event)
bool tradeAdd(InputEvent &event)
bool barToChat(InputEvent &event)
bool dropItem(InputEvent &event)
bool createItem(InputEvent &event)
bool createItems(InputEvent &event)
bool homunculusToMaster(InputEvent &event)
bool useItem(InputEvent &event)
bool protectItem(InputEvent &event)
bool disconnect(InputEvent &event)
bool dropItemId(InputEvent &event)
bool dumpEnvironment(InputEvent &event)
bool dump(InputEvent &event)
bool dropItemInv(InputEvent &event)
bool pickup(InputEvent &event)
bool info(InputEvent &event)
bool sit(InputEvent &event)
std::string toString(T const &value)
converts any type to a string
bool loadTextFileLocal(const std::string &fileName, StringVect &lines)
bool existsLocal(const std::string &path)
const ItemDB::ItemInfos & getItemInfos()
std::map< int, ItemInfo * > ItemInfos
ServerTypeT getNetworkType()
void useEquipItem(const Item *const item, const int16_t useType, const Sfx sfx)
void dropItem(const Item *const item, const int amount, const Sfx sfx)
Inventory * getInventory()
Inventory * getStorageInventory()
int32_t getAttribute(const AttributesT id)
void unprotectItem(const int id)
bool isItemProtected(const int id)
int getStatEffective(const AttributesT id)
int getSkillLevel(const int id)
void protectItem(const int id)
std::map< std::string, Resource * > Resources
Resources::iterator ResourceIterator
bool setFullScreen(const bool fs)
Net::VendingHandler * vendingHandler
Net::TradeHandler * tradeHandler
Net::ServerFeatures * serverFeatures
Net::NpcHandler * npcHandler
Net::PlayerHandler * playerHandler
static void dumpSettings()
OutfitWindow * outfitWindow
bool splitParameters(StringVect &tokens, std::string text, const std::string &separator, const char quote)
SetupWindow * setupWindow
ShortcutWindow * itemShortcutWindow
const bool ShowCenter_false
SkillDialog * skillDialog
SpellManager * spellManager
bool parse2Int(const std::string &args, int &x, int &y)
std::string stringToHexPath(const std::string &str)
std::string strprintf(const char *const format,...)
std::string removeToken(std::string &str, const std::string &token)
std::string timeDiffToString(int timeDiff)
std::vector< std::string > StringVect
TradeWindow * tradeWindow
const bool TryRemoveColors_true
WhoIsOnline * whoIsOnline