From 4ccbb18a734218751c11ee1e142c97f1c29c5577 Mon Sep 17 00:00:00 2001 From: darkrose Date: Tue, 28 Jul 2015 21:34:53 +1000 Subject: [PATCH] add extended info to inventory tooltips --- src/content_craft.cpp | 20 +-- src/content_nodemeta.cpp | 12 +- src/content_toolitem.h | 3 + src/guiFormSpecMenu.cpp | 15 +- src/gui_colours.h | 2 +- src/inventory.cpp | 308 ++++++++++++++++++++++++++++++++++++--- src/inventory.h | 127 ++++++++-------- src/mineral.h | 2 +- src/player.cpp | 38 ++--- src/server.cpp | 2 +- 10 files changed, 403 insertions(+), 126 deletions(-) diff --git a/src/content_craft.cpp b/src/content_craft.cpp index 5d1a102..d961f51 100644 --- a/src/content_craft.cpp +++ b/src/content_craft.cpp @@ -958,11 +958,11 @@ void giveCreative(Player *player) for(u8 i=0; iinventory.addItem("main", new CraftItem(creativeinv[i], 1)) == NULL) ; + assert(player->inventory.addItem("main", new CraftItem(creativeinv[i], 1,0)) == NULL) ; }else if ((creativeinv.at(i)&CONTENT_TOOLITEM_MASK) == CONTENT_TOOLITEM_MASK) { - assert(player->inventory.addItem("main", new ToolItem(creativeinv[i], 0)) == NULL) ; + assert(player->inventory.addItem("main", new ToolItem(creativeinv[i], 0,0)) == NULL) ; }else{ - assert(player->inventory.addItem("main", new MaterialItem(creativeinv[i], 1)) == NULL) ; + assert(player->inventory.addItem("main", new MaterialItem(creativeinv[i], 1,0)) == NULL) ; } } } @@ -970,13 +970,13 @@ void giveCreative(Player *player) void giveInitial(Player *player) { player->resetInventory(); - assert(player->inventory.addItem("main", new ToolItem(CONTENT_TOOLITEM_STEELPICK, 0)) == NULL) ; - assert(player->inventory.addItem("main", new ToolItem(CONTENT_TOOLITEM_STEELAXE, 0)) == NULL) ; - assert(player->inventory.addItem("main", new ToolItem(CONTENT_TOOLITEM_STEELSHOVEL, 0)) == NULL) ; - assert(player->inventory.addItem("main", new ToolItem(CONTENT_TOOLITEM_STEELSHEARS, 0)) == NULL) ; - assert(player->inventory.addItem("main", new MaterialItem(CONTENT_TORCH, 99)) == NULL) ; - assert(player->inventory.addItem("main", new MaterialItem(CONTENT_ROUGHSTONEBRICK, 99)) == NULL) ; - assert(player->inventory.addItem("main", new MaterialItem(CONTENT_BORDERSTONE, 5)) == NULL) ; + assert(player->inventory.addItem("main", new ToolItem(CONTENT_TOOLITEM_STEELPICK, 0, 0)) == NULL) ; + assert(player->inventory.addItem("main", new ToolItem(CONTENT_TOOLITEM_STEELAXE, 0, 0)) == NULL) ; + assert(player->inventory.addItem("main", new ToolItem(CONTENT_TOOLITEM_STEELSHOVEL, 0, 0)) == NULL) ; + assert(player->inventory.addItem("main", new ToolItem(CONTENT_TOOLITEM_STEELSHEARS, 0, 0)) == NULL) ; + assert(player->inventory.addItem("main", new MaterialItem(CONTENT_TORCH, 99, 0)) == NULL) ; + assert(player->inventory.addItem("main", new MaterialItem(CONTENT_ROUGHSTONEBRICK, 99, 0)) == NULL) ; + assert(player->inventory.addItem("main", new MaterialItem(CONTENT_BORDERSTONE, 5, 0)) == NULL) ; } }; diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp index 2a2ef65..063c54b 100644 --- a/src/content_nodemeta.cpp +++ b/src/content_nodemeta.cpp @@ -815,7 +815,7 @@ bool FurnaceNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env) content_t c = fuel_item->getContent(); fuel_list->decrementMaterials(1); if (c == CONTENT_TOOLITEM_STEELBUCKET_LAVA) { - fuel_list->addItem(0,new ToolItem(CONTENT_TOOLITEM_STEELBUCKET,0)); + fuel_list->addItem(0,new ToolItem(CONTENT_TOOLITEM_STEELBUCKET,0,0)); } changed = true; }else{ @@ -1085,7 +1085,7 @@ bool LockingFurnaceNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment content_t c = fuel_item->getContent(); fuel_list->decrementMaterials(1); if (c == CONTENT_TOOLITEM_STEELBUCKET_LAVA) { - fuel_list->addItem(0,new ToolItem(CONTENT_TOOLITEM_STEELBUCKET,0)); + fuel_list->addItem(0,new ToolItem(CONTENT_TOOLITEM_STEELBUCKET,0,0)); } changed = true; }else{ @@ -2038,7 +2038,7 @@ NodeMetadata* DeCraftNodeMetadata::clone() if (content_features(list[i]).dug_item == "" && content_features(list[i]).extra_dug_item == "") continue; - t = new MaterialItem(list[i],1); + t = new MaterialItem(list[i],1,0); l->addItem(t); } return d; @@ -2134,7 +2134,7 @@ bool DeCraftNodeMetadata::import(NodeMetadata *meta) if (content_features(list[i]).dug_item == "" && content_features(list[i]).extra_dug_item == "") continue; - t = new MaterialItem(list[i],1); + t = new MaterialItem(list[i],1,0); l->addItem(t); } return true; @@ -2172,7 +2172,7 @@ bool DeCraftNodeMetadata::receiveFields(std::string formname, std::mapaddItem(t); } return true; @@ -2824,7 +2824,7 @@ bool CauldronNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env) content_t c = fitem->getContent(); list->decrementMaterials(1); if (c == CONTENT_TOOLITEM_STEELBUCKET_LAVA) - list->addItem(0,new ToolItem(CONTENT_TOOLITEM_STEELBUCKET,0)); + list->addItem(0,new ToolItem(CONTENT_TOOLITEM_STEELBUCKET,0,0)); return true; } } diff --git a/src/content_toolitem.h b/src/content_toolitem.h index 7b97358..f99b665 100644 --- a/src/content_toolitem.h +++ b/src/content_toolitem.h @@ -50,6 +50,8 @@ struct ToolItemFeatures { f32 hardness; // the dig time of this tool f32 dig_time; + // the level of the tool, this affects the amount of minerals etc. + u8 level; // used for eg. bows throwing an arrow content_t thrown_item; // when this item is placed, it should be replaced by this in inventory @@ -75,6 +77,7 @@ struct ToolItemFeatures { type(TT_NONE), hardness(0.), dig_time(3.), + level(1), thrown_item(CONTENT_IGNORE), onplace_replace_item(CONTENT_IGNORE), onplace_node(CONTENT_IGNORE) diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 6ad64e6..2ba41dd 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -455,14 +455,14 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) // Add tooltip { // Note: parent != this so that the tooltip isn't clipped by the menu rectangle - m_tooltip_element = Environment->addStaticText(L"",core::rect(0,0,110,18)); + m_tooltip_element = Environment->addStaticText(L"",core::rect(0,0,1000,18)); m_tooltip_element->enableOverrideColor(true); m_tooltip_element->setBackgroundColor(GUI_BG_TT); m_tooltip_element->setDrawBackground(true); m_tooltip_element->setDrawBorder(true); m_tooltip_element->setOverrideColor(GUI_TT_TEXT); - m_tooltip_element->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_CENTER); - m_tooltip_element->setWordWrap(false); + m_tooltip_element->setTextAlignment(gui::EGUIA_UPPERLEFT, gui::EGUIA_CENTER); + m_tooltip_element->setWordWrap(true); } } @@ -532,13 +532,20 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase) if (item) { draw_inv_item(driver, font, item, rect, &AbsoluteClippingRect); if (rect.isPointInside(m_pointer)) { - std::wstring name = item->getGuiName(); + std::wstring name = item->getGuiText(); if (name != L"") { m_tooltip_element->setVisible(true); this->bringToFront(m_tooltip_element); m_tooltip_element->setText(name.c_str()); s32 tooltip_x = m_pointer.X + 15; s32 tooltip_y = m_pointer.Y + 15; + // this prevents forced word-wrap when we don't want it + m_tooltip_element->setRelativePosition( + core::rect( + core::position2d(tooltip_x, tooltip_y), + core::dimension2d(1000,18) + ) + ); s32 tooltip_width = m_tooltip_element->getTextWidth() + 14; s32 tooltip_height = m_tooltip_element->getTextHeight() + 4; m_tooltip_element->setRelativePosition( diff --git a/src/gui_colours.h b/src/gui_colours.h index 6d8f468..42fa448 100644 --- a/src/gui_colours.h +++ b/src/gui_colours.h @@ -9,7 +9,7 @@ #define GUI_BG_DEATH video::SColor(180,50,0,0) -#define GUI_BG_TT video::SColor(140,30,30,50) +#define GUI_BG_TT video::SColor(200,30,30,50) #define GUI_TT_TEXT video::SColor(255,255,255,255) #define GUI_INV_BORDER video::SColor(245,60,60,80) diff --git a/src/inventory.cpp b/src/inventory.cpp index 26391ad..e853040 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -36,28 +36,31 @@ #include "content_mob.h" #include "player.h" #include "log.h" +#include "intl.h" /* InventoryItem */ -InventoryItem::InventoryItem(u16 count) +InventoryItem::InventoryItem(u16 count, u16 data) { m_content = CONTENT_IGNORE; m_count = count; + m_data = data; } InventoryItem::~InventoryItem() { } -content_t InventoryItem::info(std::istream &is, u16 *count, u16 *wear) +content_t InventoryItem::info(std::istream &is, u16 *count, u16 *wear, u16 *data) { DSTACK(__FUNCTION_NAME); content_t c = CONTENT_IGNORE; *count = 0; *wear = 0; + *data = 0; //is.imbue(std::locale("C")); // Read name @@ -79,33 +82,59 @@ content_t InventoryItem::info(std::istream &is, u16 *count, u16 *wear) if (material > MAX_CONTENT) throw SerializationError("Too large material number"); c = material; + }else if(name == "MaterialItem3") { + u16 material; + is>>material; + is>>(*count); + is>>(*data); + if (material > MAX_CONTENT) + throw SerializationError("Too large material number"); + c = material; }else if(name == "CraftItem") { std::string subname; std::getline(is, subname, ' '); is>>(*count); - CraftItem itm(subname, *count); + CraftItem itm(subname, *count, 0); c = itm.getContent(); }else if(name == "CraftItem2") { u16 material; is>>material; is>>(*count); c = material; + }else if(name == "CraftItem3") { + u16 material; + is>>material; + is>>(*count); + is>>(*data); + c = material; }else if(name == "ToolItem") { std::string toolname; std::getline(is, toolname, ' '); is>>(*wear); - ToolItem itm(toolname, *wear); + ToolItem itm(toolname, *wear, 0); c = itm.getContent(); }else if(name == "ToolItem2") { u16 material; is>>material; is>>(*wear); c = material; + }else if(name == "ToolItem3") { + u16 material; + is>>material; + is>>(*wear); + is>>(*data); + c = material; }else if(name == "ClothesItem") { u16 material; is>>material; is>>(*wear); c = material; + }else if(name == "ClothesItem2") { + u16 material; + is>>material; + is>>(*wear); + is>>(*data); + c = material; }else if (name != "") { infostream<<"Unknown InventoryItem name=\""<description; + if (f->cook_result != "" || f->fuel_time != 0.0) + txt += L"\n"; + if (f->cook_result != "") { + txt += L"\n"; + txt += wgettext("Cookable: Yes"); + } + if (f->fuel_time != 0.0) { + char buff[20]; + txt += L"\n"; + txt += wgettext("Fuel Burn Time: "); + txt += itows((int)f->fuel_time/60); + txt += L":"; + sprintf(buff,"%02d",(int)f->fuel_time%60); + txt += narrow_to_wide(buff); + } + + return txt; +} bool MaterialItem::isCookable() const { @@ -210,6 +263,61 @@ std::wstring CraftItem::getGuiName() { return content_craftitem_features(m_content).description; } +std::wstring CraftItem::getGuiText() +{ + std::wstring txt(L" "); + CraftItemFeatures *f = &content_craftitem_features(m_content); + txt += f->description; + if (f->consumable || f->cook_result != "" || f->fuel_time != 0.0) + txt += L"\n"; + if (f->consumable) { + if (f->hunger_effect) { + txt += L"\n"; + txt += wgettext("Hunger: "); + txt += itows(f->hunger_effect*5); + txt += L"%"; + } + if (f->health_effect) { + txt += L"\n"; + txt += wgettext("Health: "); + txt += itows(f->health_effect*5); + txt += L"%"; + } + if (f->cold_effect) { + char buff[20]; + txt += L"\n"; + txt += wgettext("Cold Protection: "); + txt += itows(f->cold_effect/60); + txt += L":"; + sprintf(buff,"%02d",f->cold_effect%60); + txt += narrow_to_wide(buff); + } + if (f->energy_effect) { + char buff[20]; + txt += L"\n"; + txt += wgettext("Energy Boost: "); + txt += itows(f->energy_effect/60); + txt += L":"; + sprintf(buff,"%02d",f->energy_effect%60); + txt += narrow_to_wide(buff); + } + } + if (f->cook_result != "") { + txt += L"\n"; + txt += wgettext("Cookable: Yes"); + } + if (f->fuel_time != 0.0) { + char buff[20]; + txt += L"\n"; + txt += wgettext("Fuel Burn Time: "); + txt += itows((int)f->fuel_time/60); + txt += L":"; + sprintf(buff,"%02d",(int)f->fuel_time%60); + txt += narrow_to_wide(buff); + } + + return txt; +} ServerActiveObject* CraftItem::createSAO(ServerEnvironment *env, u16 id, v3f pos) { @@ -298,6 +406,60 @@ bool CraftItem::use(ServerEnvironment *env, Player *player) return false; } +/* + ToolItem +*/ + +#ifndef SERVER +video::ITexture *ToolItem::getImage() const +{ + if(g_texturesource == NULL) + return NULL; + + std::string basename = getBasename(); + + /* + Calculate a progress value with sane amount of + maximum states + */ + u32 maxprogress = 30; + u32 toolprogress = (65535-m_wear)/(65535/maxprogress); + + float value_f = (float)toolprogress / (float)maxprogress; + std::ostringstream os; + os<getTextureRaw(os.str()); +} +#endif + +std::wstring ToolItem::getGuiText() +{ + std::wstring txt(L" "); + ToolItemFeatures *f = &content_toolitem_features(m_content); + txt += f->description; + txt += L"\n\n"; + txt += wgettext("Strength: "); + txt += ftows(f->hardness); + txt += L"\n"; + txt += wgettext("Speed: "); + txt += ftows(f->dig_time); + txt += L"\n"; + txt += wgettext("Level: "); + txt += itows(f->level); + if (f->fuel_time != 0.0) { + char buff[20]; + txt += L"\n"; + txt += wgettext("Fuel Burn Time: "); + txt += itows((int)f->fuel_time/60); + txt += L":"; + sprintf(buff,"%02d",(int)f->fuel_time%60); + txt += narrow_to_wide(buff); + } + + return txt; +} + bool ToolItem::isCookable() const { return content_toolitem_features(m_content).cook_result != ""; @@ -319,6 +481,79 @@ float ToolItem::getFuelTime() const return content_toolitem_features(m_content).fuel_time; } +/* + ClothesItem +*/ + +#ifndef SERVER +video::ITexture *ClothesItem::getImage() const +{ + if (g_texturesource == NULL) + return NULL; + + std::string basename = getBasename(); + + /* + Calculate a progress value with sane amount of + maximum states + */ + u32 maxprogress = 30; + u32 toolprogress = (65535-m_wear)/(65535/maxprogress); + + float value_f = (float)toolprogress / (float)maxprogress; + std::ostringstream os; + os<getTextureRaw(os.str()); +} +#endif + +std::wstring ClothesItem::getGuiText() +{ + std::wstring txt(L" "); + ClothesItemFeatures *f = &content_clothesitem_features(m_content); + txt += f->description; + if (f->armour > 0.0 || f->warmth > 0.0 || f->vacuum > 0.0 || f->suffocate > 0.0 || f->durability > 0.0 || f->effect > 1.0) + txt += L"\n"; + if (f->armour > 0.0) { + txt += L"\n"; + txt += wgettext("Armour: "); + txt += itows(f->armour*100.0); + txt += L"%"; + } + if (f->warmth > 0.0) { + txt += L"\n"; + txt += wgettext("Warmth: "); + txt += itows(f->warmth*100.0); + txt += L"%"; + } + if (f->vacuum > 0.0) { + txt += L"\n"; + txt += wgettext("Pressure: "); + txt += itows(f->vacuum*100.0); + txt += L"%"; + } + if (f->suffocate > 0.0) { + txt += L"\n"; + txt += wgettext("Suffocation: "); + txt += itows(f->suffocate*100.0); + txt += L"%"; + } + if (f->durability > 0.0) { + txt += L"\n"; + txt += wgettext("Durability: "); + txt += itows(f->durability); + } + if (f->effect != 1.0) { + txt += L"\n"; + txt += wgettext("Effect Boost: "); + txt += itows(f->effect*100.0); + txt += L"%"; + } + + return txt; +} + /* Inventory */ @@ -356,13 +591,11 @@ void InventoryList::clearItems() for (u32 i=0; igetCount()); } + writeU16(os,item->getData()); }else{ writeU16(os,CONTENT_IGNORE); } @@ -385,6 +619,44 @@ void InventoryList::deSerialize(std::istream &is) u32 item_i = 0; char f; is.get(f); + if (f == '\1') { + char v; + is.get(v); + switch (v) { + case 1: + { + for (item_i=0; item_igetContent() == c) { + m_items[item_i]->setWear(wc); + m_items[item_i]->setCount(wc); + m_items[item_i]->setData(d); + continue; + } + delete m_items[item_i]; + } + m_items[item_i] = InventoryItem::create(c,wc,wc,d); + } + } + break; + default: + throw SerializationError("Unknown inventory format"); + } + + if (readU8(is) != 3) + throw SerializationError("Unknown inventory identifier"); + + return; + } if (f == '\2') { for (item_i=0; item_igetContent() == c) { m_items[item_i]->setWear(wear); m_items[item_i++]->setCount(count); + m_items[item_i++]->setData(data); continue; } delete m_items[item_i]; @@ -824,8 +1098,8 @@ void Inventory::serialize(std::ostream &os) const InventoryList *list = m_lists[i]; os<getName()<<" "; writeU16(os,list->getSize()); - // start text - writeU8(os,2); + // start header + writeU8(os,1); list->serialize(os); // end text writeU8(os,3); diff --git a/src/inventory.h b/src/inventory.h index 63b5d28..38a3786 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -50,12 +50,12 @@ class Player; class InventoryItem { public: - InventoryItem(u16 count); + InventoryItem(u16 count, u16 data); virtual ~InventoryItem(); - static content_t info(std::istream &is, u16 *count, u16 *wear); + static content_t info(std::istream &is, u16 *count, u16 *wear, u16 *data); static InventoryItem* deSerialize(std::istream &is); - static InventoryItem* create(content_t c, u16 count, u16 wear=0); + static InventoryItem* create(content_t c, u16 count, u16 wear=0, u16 data=0); virtual const char* getName() const = 0; // Shall write the name and the parameters @@ -74,6 +74,8 @@ public: content_t getContent() {return m_content;} // this is used for tool tips virtual std::wstring getGuiName() { return L""; } + // this is used for hover data / extended tool tips + virtual std::wstring getGuiText() { return L""; } // Shall return a text to show in the GUI virtual std::string getText() { return ""; } // Returns the string used for inventory @@ -114,12 +116,19 @@ public: } void remove(u16 count) { - assert(m_count >= count); - m_count -= count; + if (m_count < count) { + m_count = 0; + }else{ + m_count -= count; + } } virtual void setWear(u16 wear) {} virtual u16 getWear() {return 0;} + void setData(u16 data) { m_data = data; } + void addData(u16 data) { m_data |= data; } + u16 getData() { return m_data; } + /* Other properties */ @@ -144,13 +153,14 @@ public: protected: u16 m_count; content_t m_content; + u16 m_data; }; class MaterialItem : public InventoryItem { public: - MaterialItem(content_t content, u16 count): - InventoryItem(count) + MaterialItem(content_t content, u16 count, u16 data): + InventoryItem(count,data) { MapNode n(content); n = mapnode_translate_to_internal(n,SER_FMT_VER_HIGHEST); @@ -166,15 +176,17 @@ public: virtual void serialize(std::ostream &os) const { //os.imbue(std::locale("C")); - os<<"MaterialItem2"; + os<<"MaterialItem3"; os<<" "; os<<(unsigned int)m_content; os<<" "; os<getContent(); + u16 d = ((InventoryItem*)other)->getData(); if (c != m_content) return false; + if (m_data != d) + return false; return true; } u16 freeSpace() const @@ -235,14 +252,14 @@ private: class CraftItem : public InventoryItem { public: - CraftItem(std::string subname, u16 count): - InventoryItem(count) + CraftItem(std::string subname, u16 count, u16 data): + InventoryItem(count,data) { m_subname = content_craftitem_features(subname).name; m_content = content_craftitem_features(subname).content; } - CraftItem(content_t content, u16 count): - InventoryItem(count) + CraftItem(content_t content, u16 count, u16 data): + InventoryItem(count,data) { m_subname = content_craftitem_features(content).name; m_content = content_craftitem_features(content).content; @@ -256,21 +273,24 @@ public: } virtual void serialize(std::ostream &os) const { - os<<"CraftItem2"; + os<<"CraftItem3"; os<<" "; os<<(unsigned int)m_content; os<<" "; os<getContent(); + u16 d = ((InventoryItem*)other)->getData(); if (c != m_content) return false; + if (m_data != d) + return false; return true; } u16 freeSpace() const @@ -323,15 +346,15 @@ private: class ToolItem : public InventoryItem { public: - ToolItem(std::string toolname, u16 wear): - InventoryItem(1) + ToolItem(std::string toolname, u16 wear, u16 data): + InventoryItem(1,data) { m_wear = wear; m_toolname = content_toolitem_features(toolname).name; m_content = content_toolitem_features(toolname).content; } - ToolItem(content_t content, u16 wear): - InventoryItem(1) + ToolItem(content_t content, u16 wear, u16 data): + InventoryItem(1,data) { m_wear = wear; m_toolname = content_toolitem_features(content).name; @@ -346,41 +369,24 @@ public: } virtual void serialize(std::ostream &os) const { - os<<"ToolItem2"; + os<<"ToolItem3"; os<<" "; os<<(unsigned int)m_content; os<<" "; os<getTextureRaw(os.str()); - } + video::ITexture * getImage() const; video::ITexture * getImageRaw() const { @@ -390,9 +396,11 @@ public: return g_texturesource->getTextureRaw(getBasename()); } #endif - std::wstring getGuiName() { + std::wstring getGuiName() + { return content_toolitem_features(m_content).description; } + std::wstring getGuiText(); std::string getText() { return ""; @@ -435,8 +443,8 @@ private: class ClothesItem : public InventoryItem { public: - ClothesItem(content_t content, u16 wear): - InventoryItem(1) + ClothesItem(content_t content, u16 wear, u16 data): + InventoryItem(1,data) { m_wear = wear; m_content = content_clothesitem_features(content).content; @@ -450,41 +458,24 @@ public: } virtual void serialize(std::ostream &os) const { - os<<"ClothesItem"; + os<<"ClothesItem2"; os<<" "; os<<(unsigned int)m_content; os<<" "; os<getTextureRaw(os.str()); - } + video::ITexture * getImage() const; video::ITexture * getImageRaw() const { @@ -494,9 +485,11 @@ public: return g_texturesource->getTextureRaw(getBasename()); } #endif - std::wstring getGuiName() { + std::wstring getGuiName() + { return content_clothesitem_features(m_content).description; } + std::wstring getGuiText(); std::string getText() { return ""; diff --git a/src/mineral.h b/src/mineral.h index f7a5c73..fac72e4 100644 --- a/src/mineral.h +++ b/src/mineral.h @@ -70,7 +70,7 @@ inline CraftItem * getDiggedMineralItem(u8 mineral) if (m.dug_item == CONTENT_IGNORE) return NULL; - return new CraftItem(content_craftitem_features(m.dug_item).name,m.dug_count); + return new CraftItem(content_craftitem_features(m.dug_item).name,m.dug_count, 0); } #endif diff --git a/src/player.cpp b/src/player.cpp index 559c666..2881620 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -434,22 +434,22 @@ void ServerRemotePlayer::setCharDef(std::string d) return; InventoryItem *item = NULL; if (shirt == "white") { - item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT,0,0); }else if (shirt == "blue") { - item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_BLUE,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_BLUE,0,0); }else if (shirt == "orange") { - item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_ORANGE,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_ORANGE,0,0); }else if (shirt == "purple") { - item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_PURPLE,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_PURPLE,0,0); }else if (shirt == "red") { - item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_RED,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_RED,0,0); }else if (shirt == "yellow") { - item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_YELLOW,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_YELLOW,0,0); }else if (shirt == "black") { - item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_BLACK,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_BLACK,0,0); } if (item == NULL) - item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_GREEN,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_COTTON_TSHIRT_GREEN,0,0); l->addItem(0,item); } { @@ -458,22 +458,22 @@ void ServerRemotePlayer::setCharDef(std::string d) return; InventoryItem *item = NULL; if (pants == "white") { - item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS,0,0); }else if (pants == "green") { - item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_GREEN,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_GREEN,0,0); }else if (pants == "orange") { - item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_ORANGE,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_ORANGE,0,0); }else if (pants == "purple") { - item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_PURPLE,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_PURPLE,0,0); }else if (pants == "red") { - item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_RED,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_RED,0,0); }else if (pants == "yellow") { - item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_YELLOW,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_YELLOW,0,0); }else if (pants == "black") { - item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_BLACK,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_BLACK,0,0); } if (item == NULL) - item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_BLUE,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_PANTS_BLUE,0,0); l->addItem(0,item); } { @@ -482,12 +482,12 @@ void ServerRemotePlayer::setCharDef(std::string d) return; InventoryItem *item = NULL; if (shirt == "fur") { - item = new ClothesItem(CONTENT_CLOTHESITEM_FUR_SHOES,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_FUR_SHOES,0,0); }else if (shirt == "canvas") { - item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_SHOES,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_CANVAS_SHOES,0,0); } if (item == NULL) - item = new ClothesItem(CONTENT_CLOTHESITEM_LEATHER_SHOES,0); + item = new ClothesItem(CONTENT_CLOTHESITEM_LEATHER_SHOES,0,0); l->addItem(0,item); } diff --git a/src/server.cpp b/src/server.cpp index 47a0f62..401128d 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2894,7 +2894,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) content_t c = fitem->getContent(); ilist->deleteItem(0); if (c == CONTENT_TOOLITEM_STEELBUCKET_LAVA) - ilist->addItem(0,new ToolItem(CONTENT_TOOLITEM_STEELBUCKET,0)); + ilist->addItem(0,new ToolItem(CONTENT_TOOLITEM_STEELBUCKET,0,0)); }else{ fitem->remove(1); }