nametag::nametag(IDWriteTextFormat* fnt, textcolor col, vector<texture> t, string n, vector2d p) { content = textlabel(fnt, col, n); tag.first = t; position = p; active = false; }
nametag::nametag(IDWriteTextFormat* fnt, textcolor col, pair<vector<texture>, vector<texture>> t, string n, vector2d p, bool a) { content = textlabel(fnt, col, n); tag = t; position = p; active = a; }
statsinfo::statsinfo(maplestats* st, inventory* iv) { app.getimgcache()->setmode(ict_sys); nl::node src = nl::nx::nodes["UI"]["UIWindow4.img"]["Stat"]["main"]; nl::node detail = nl::nx::nodes["UI"]["UIWindow4.img"]["Stat"]["detail"]; sprites.push_back(sprite(animation(src["backgrnd"]), vector2d())); sprites.push_back(sprite(animation(src["backgrnd2"]), vector2d())); sprites.push_back(sprite(animation(src["backgrnd3"]), vector2d())); detailbgs.push_back(texture(detail["backgrnd"])); detailbgs.push_back(texture(detail["backgrnd2"])); detailbgs.push_back(texture(detail["backgrnd3"])); abilities["rare"] = texture(detail["abilityTitle"]["rare"]["0"]); abilities["epic"] = texture(detail["abilityTitle"]["epic"]["0"]); abilities["unique"] = texture(detail["abilityTitle"]["unique"]["0"]); abilities["legendary"] = texture(detail["abilityTitle"]["legendary"]["0"]); abilities["none"] = texture(detail["abilityTitle"]["normal"]["0"]); buttons[BT_STATS_HP] = button(src["BtHpUp"]); buttons[BT_STATS_MP] = button(src["BtMpUp"]); buttons[BT_STATS_STR] = button(src["BtStrUp"]); buttons[BT_STATS_DEX] = button(src["BtDexUp"]); buttons[BT_STATS_LUK] = button(src["BtLukUp"]); buttons[BT_STATS_INT] = button(src["BtIntUp"]); if (st->getstat(MS_AP) == 0) { buttons[BT_STATS_HP].setstate(BTS_DISABLED); buttons[BT_STATS_MP].setstate(BTS_DISABLED); buttons[BT_STATS_STR].setstate(BTS_DISABLED); buttons[BT_STATS_DEX].setstate(BTS_DISABLED); buttons[BT_STATS_LUK].setstate(BTS_DISABLED); buttons[BT_STATS_INT].setstate(BTS_DISABLED); } buttons[BT_STATS_DETAILOPEN] = button(src["BtDetailOpen"]); buttons[BT_STATS_DETAILCLOSE] = button(src["BtDetailClose"]); buttons[BT_STATS_DETAILCLOSE].setactive(false); statlabel = textlabel(DWF_12L, TXC_BLACK, ""); app.getimgcache()->unlock(); position = config.getconfig()->statsinfopos; dimensions = vector2d(212, 318); active = true; dragged = false; buttoncd = 0; showdetail = false; stats = st; invent = iv; }
chatbar::chatbar() { app.getimgcache()->setmode(ict_sys); node mainbar = nx::nodes["UI"]["StatusBar2.img"]["mainBar"]; node chat = nx::nodes["UI"]["StatusBar2.img"]["chat"]; open = config.getconfig()->chatopen; buttons[BT_BAR_OPENCHAT] = button(mainbar["chatOpen"]); buttons[BT_BAR_CLOSECHAT] = button(mainbar["chatClose"]); buttons[BT_BAR_SCROLLUP] = button(mainbar["scrollUp"]); buttons[BT_BAR_SCROLLDOWN] = button(mainbar["scrollDown"]); buttons[BT_BAR_CHATTARGET] = button(mainbar["chatTarget"]["base"]); buttons[BT_BAR_CHATTARGET].setactive(open); buttons[open ? BT_BAR_OPENCHAT : BT_BAR_CLOSECHAT].setactive(false); chatspace[false] = texture(mainbar["chatSpace"]); chatspace[true] = texture(mainbar["chatEnter"]); chatenter = texture(mainbar["chatSpace2"]); chatcover = texture(mainbar["chatCover"]); chattargets[CHT_ALL] = texture(mainbar["chatTarget"]["all"]); chattargets[CHT_BUDDY] = texture(mainbar["chatTarget"]["friend"]); chattargets[CHT_GUILD] = texture(mainbar["chatTarget"]["guild"]); chattargets[CHT_ALLIANCE] = texture(mainbar["chatTarget"]["association"]); chattargets[CHT_PARTY] = texture(mainbar["chatTarget"]["party"]); chattargets[CHT_SQUAD] = texture(mainbar["chatTarget"]["expedition"]); textfields[TXT_CHAT] = textfield(TXT_CHAT, DWF_12L, TXC_BLACK, "", vector2d(-430, -60), 64); textfields[TXT_CHAT].setactive(open); closedtext = textlabel(DWF_12L, TXC_WHITE, ""); app.getimgcache()->unlock(); position = vector2d(512, 590); dimensions = vector2d(500, 80); active = true; dragged = false; buttoncd = 0; chattarget = CHT_ALL; }
textfield::textfield(textid i, dwfonts fnt, textcolor col, string def, vector2d pos, int max) { init(); getfont(fnt); settext(def); color = col; id = i; position = pos; maxlength = max; marker = textlabel(fnt, col, "|"); markpos = text.length(); crypt = 0; active = true; focused = false; showmark = false; }
tooltip::tooltip(string text, tooltiptype type, vector2d pos) { position = pos; info = textlabel(DWF_12L, TXC_WHITE, ""); active = true; }
npc::npc(int id, int o, bool fl, short f, vector2d pos) { string strid = to_string(id); strid.insert(0, 7 - strid.size(), '0'); strid.append(".img"); node src = nx::nodes["Npc"][strid]; string link = src["info"]["link"].tostr(); if (link.size() > 0) { link.append(".img"); src = nx::nodes["Npc"][link]; } map<string, vector<string>> linenames; for (node npcnode = src.begin(); npcnode != src.end(); npcnode++) { string state = npcnode.name(); if (state == "info") { hidename = npcnode["hideName"].tobl(); mouseonly = npcnode["talkMouseOnly"].tobl(); scripted = npcnode["script"].size() > 0; } else { textures[state] = animation(npcnode); states.push_back(state); } node speak = npcnode["speak"]; if (speak.size() > 0) { for (node speaknode = speak.begin(); speaknode != speak.end(); speaknode++) { linenames[state].push_back(speaknode.get_string()); } } } node strsrc = nx::nodes["String"]["Npc.img"][to_string(id)]; name = strsrc["name"].tostr(); func = strsrc["func"].tostr(); for (map<string, vector<string>>::iterator stit = linenames.begin(); stit != linenames.end(); ++stit) { string state = stit->first; vector<string> names = stit->second; for (vector<string>::iterator nit = names.begin(); nit != names.end(); ++nit) { lines[state].push_back(strsrc[*nit].tostr()); } } ntag = textlabel(DWF_14BC, TXC_YELLOW, name); ftag = textlabel(DWF_14BC, TXC_YELLOW, func); ntag.setback(TXB_NAMETAG); ftag.setback(TXB_NAMETAG); oid = o; flip = !fl; fh = f; position = pos; state = "stand"; }