enchantments pt1
After Width: | Height: | Size: 395 B |
After Width: | Height: | Size: 410 B |
After Width: | Height: | Size: 386 B |
After Width: | Height: | Size: 400 B |
After Width: | Height: | Size: 434 B |
After Width: | Height: | Size: 332 B |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 419 B |
After Width: | Height: | Size: 321 B |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 277 B |
After Width: | Height: | Size: 292 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 232 B |
After Width: | Height: | Size: 265 B |
|
@ -192,6 +192,7 @@ set(common_SRCS
|
|||
serverobject.cpp
|
||||
noise.cpp
|
||||
mineral.cpp
|
||||
enchantment.cpp
|
||||
porting.cpp
|
||||
defaultsettings.cpp
|
||||
mapnode.cpp
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
struct CraftItemFeatures {
|
||||
content_t content;
|
||||
std::string texture;
|
||||
// if additional overlays are used, the texture name is made from
|
||||
// <overlay_base>_<overlay>.png
|
||||
std::string overlay_base;
|
||||
// the old 'subname'
|
||||
std::string name;
|
||||
// tooltip used in inventory
|
||||
|
@ -73,6 +76,7 @@ struct CraftItemFeatures {
|
|||
CraftItemFeatures():
|
||||
content(CONTENT_IGNORE),
|
||||
texture("unknown_item.png"),
|
||||
overlay_base(""),
|
||||
name(""),
|
||||
description(L""),
|
||||
cook_result(CONTENT_IGNORE),
|
||||
|
|
|
@ -108,6 +108,46 @@ DiggingProperties getDiggingProperties(content_t content, content_t tool)
|
|||
return DiggingProperties(diggable,time,wear);
|
||||
}
|
||||
|
||||
std::string toolitem_overlay(content_t content, std::string ol)
|
||||
{
|
||||
ToolItemFeatures t_features = content_toolitem_features(content);
|
||||
if (ol == "")
|
||||
return "";
|
||||
std::string base = "tool_overlay_";
|
||||
switch (t_features.type) {
|
||||
case TT_AXE:
|
||||
base += "axe_";
|
||||
break;
|
||||
case TT_PICK:
|
||||
base += "pick_";
|
||||
break;
|
||||
case TT_SHOVEL:
|
||||
base += "shovel_";
|
||||
break;
|
||||
case TT_SWORD:
|
||||
base += "sword_";
|
||||
break;
|
||||
case TT_SHEAR:
|
||||
base += "shear_";
|
||||
break;
|
||||
case TT_BUCKET:
|
||||
base += "bucket_";
|
||||
break;
|
||||
case TT_SPEAR:
|
||||
base += "spear_";
|
||||
break;
|
||||
case TT_SPECIAL:
|
||||
case TT_NONE:
|
||||
default:
|
||||
return "";
|
||||
break;
|
||||
}
|
||||
|
||||
base += ol;
|
||||
base += ".png";
|
||||
return base;
|
||||
}
|
||||
|
||||
void content_toolitem_init()
|
||||
{
|
||||
g_content_toolitem_features.clear();
|
||||
|
@ -551,4 +591,209 @@ void content_toolitem_init()
|
|||
}
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_RAW_PICK;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_raw_pick.png";
|
||||
f->name = "mithril_raw_pick";
|
||||
f->description = wgettext("Raw Mithril Pick");
|
||||
f->type = TT_PICK;
|
||||
f->hardness = 500.;
|
||||
f->dig_time = 0.3;
|
||||
f->level = 4;
|
||||
crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL_RAW,CONTENT_TOOLITEM_MITHRIL_RAW_PICK);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_RAW_SHOVEL;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_raw_shovel.png";
|
||||
f->name = "mithril_raw_shovel";
|
||||
f->description = wgettext("Raw Mithril Shovel");
|
||||
f->type = TT_SHOVEL;
|
||||
f->hardness = 500.;
|
||||
f->dig_time = 0.1;
|
||||
f->level = 4;
|
||||
crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL_RAW,CONTENT_TOOLITEM_MITHRIL_RAW_SHOVEL);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_RAW_AXE;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_raw_axe.png";
|
||||
f->name = "mithril_raw_axe";
|
||||
f->description = wgettext("Raw Mithril Axe");
|
||||
f->type = TT_AXE;
|
||||
f->hardness = 500.;
|
||||
f->dig_time = 0.3;
|
||||
f->level = 4;
|
||||
crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL_RAW,CONTENT_TOOLITEM_MITHRIL_RAW_AXE);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_RAW_SWORD;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_raw_sword.png";
|
||||
f->name = "mithril_raw_sword";
|
||||
f->description = wgettext("Raw Mithril Sword");
|
||||
f->type = TT_SWORD;
|
||||
f->hardness = 500.;
|
||||
f->dig_time = 0.3;
|
||||
f->level = 4;
|
||||
crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL_RAW,CONTENT_TOOLITEM_MITHRIL_RAW_SWORD);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_RAW_SPEAR;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_raw_spear.png";
|
||||
f->name = "mithril_raw_spear";
|
||||
f->description = wgettext("Raw Mithril Spear");
|
||||
f->type = TT_SPEAR;
|
||||
f->hardness = 400.;
|
||||
f->dig_time = 0.3;
|
||||
f->level = 4;
|
||||
crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL_RAW,CONTENT_TOOLITEM_MITHRIL_RAW_SPEAR);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_PICK;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_pick.png";
|
||||
f->name = "mithril_unbound_pick";
|
||||
f->description = wgettext("Unbound Mithril Pick");
|
||||
f->type = TT_PICK;
|
||||
f->hardness = 700.;
|
||||
f->dig_time = 0.2;
|
||||
f->level = 5;
|
||||
crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_PICK);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_SHOVEL;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_shovel.png";
|
||||
f->name = "mithril_unbound_shovel";
|
||||
f->description = wgettext("Unbound Mithril Shovel");
|
||||
f->type = TT_SHOVEL;
|
||||
f->hardness = 700.;
|
||||
f->dig_time = 0.05;
|
||||
f->level = 5;
|
||||
crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SHOVEL);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_AXE;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_axe.png";
|
||||
f->name = "mithril_unbound_axe";
|
||||
f->description = wgettext("Unbound Mithril Axe");
|
||||
f->type = TT_AXE;
|
||||
f->hardness = 700.;
|
||||
f->dig_time = 0.2;
|
||||
f->level = 5;
|
||||
crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_AXE);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_SWORD;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_sword.png";
|
||||
f->name = "mithril_unbound_sword";
|
||||
f->description = wgettext("Unbound Mithril Sword");
|
||||
f->type = TT_SWORD;
|
||||
f->hardness = 700.;
|
||||
f->dig_time = 0.2;
|
||||
f->level = 5;
|
||||
crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SWORD);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_SPEAR;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_spear.png";
|
||||
f->name = "mithril_unbound_spear";
|
||||
f->description = wgettext("Unbound Mithril Spear");
|
||||
f->type = TT_SPEAR;
|
||||
f->hardness = 600.;
|
||||
f->dig_time = 0.2;
|
||||
f->level = 5;
|
||||
crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SPEAR);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_PICK;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_pick.png";
|
||||
f->name = "mithril_pick";
|
||||
f->description = wgettext("Mithril Pick");
|
||||
f->type = TT_PICK;
|
||||
f->hardness = 700.;
|
||||
f->dig_time = 0.2;
|
||||
f->level = 5;
|
||||
crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_PICK);
|
||||
lists::add("craftguide",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_SHOVEL;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_shovel.png";
|
||||
f->name = "mithril_shovel";
|
||||
f->description = wgettext("Mithril Shovel");
|
||||
f->type = TT_SHOVEL;
|
||||
f->hardness = 700.;
|
||||
f->dig_time = 0.05;
|
||||
f->level = 5;
|
||||
crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SHOVEL);
|
||||
lists::add("craftguide",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_AXE;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_axe.png";
|
||||
f->name = "mithril_axe";
|
||||
f->description = wgettext("Mithril Axe");
|
||||
f->type = TT_AXE;
|
||||
f->hardness = 700.;
|
||||
f->dig_time = 0.2;
|
||||
f->level = 5;
|
||||
crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_AXE);
|
||||
lists::add("craftguide",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_SWORD;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_sword.png";
|
||||
f->name = "mithril_sword";
|
||||
f->description = wgettext("Mithril Sword");
|
||||
f->type = TT_SWORD;
|
||||
f->hardness = 700.;
|
||||
f->dig_time = 0.2;
|
||||
f->level = 5;
|
||||
crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SWORD);
|
||||
lists::add("craftguide",i);
|
||||
|
||||
i = CONTENT_TOOLITEM_MITHRIL_SPEAR;
|
||||
f = &g_content_toolitem_features[i];
|
||||
f->content = i;
|
||||
f->texture = "tool_mithril_spear.png";
|
||||
f->name = "mithril_spear";
|
||||
f->description = wgettext("Mithril Spear");
|
||||
f->type = TT_SPEAR;
|
||||
f->hardness = 600.;
|
||||
f->dig_time = 0.2;
|
||||
f->level = 5;
|
||||
crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SPEAR);
|
||||
lists::add("craftguide",i);
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ struct DiggingProperties
|
|||
|
||||
// For getting the default properties, set toolid=CONTENT_IGNORE
|
||||
DiggingProperties getDiggingProperties(content_t material, content_t toolid);
|
||||
std::string toolitem_overlay(content_t content, std::string ol);
|
||||
void content_toolitem_init();
|
||||
ToolItemFeatures & content_toolitem_features(content_t i);
|
||||
ToolItemFeatures & content_toolitem_features(std::string subname);
|
||||
|
@ -142,5 +143,20 @@ ToolItemFeatures & content_toolitem_features(std::string subname);
|
|||
#define CONTENT_TOOLITEM_FLINTSPEAR (CONTENT_TOOLITEM_MASK | 0x1E)
|
||||
#define CONTENT_TOOLITEM_STEELSPEAR (CONTENT_TOOLITEM_MASK | 0x1F)
|
||||
#define CONTENT_TOOLITEM_BOW (CONTENT_TOOLITEM_MASK | 0x20)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_RAW_PICK (CONTENT_TOOLITEM_MASK | 0x21)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_RAW_SHOVEL (CONTENT_TOOLITEM_MASK | 0x22)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_RAW_AXE (CONTENT_TOOLITEM_MASK | 0x23)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_RAW_SWORD (CONTENT_TOOLITEM_MASK | 0x24)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_RAW_SPEAR (CONTENT_TOOLITEM_MASK | 0x25)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_UNBOUND_PICK (CONTENT_TOOLITEM_MASK | 0x26)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_UNBOUND_SHOVEL (CONTENT_TOOLITEM_MASK | 0x27)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_UNBOUND_AXE (CONTENT_TOOLITEM_MASK | 0x28)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_UNBOUND_SWORD (CONTENT_TOOLITEM_MASK | 0x29)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_UNBOUND_SPEAR (CONTENT_TOOLITEM_MASK | 0x2A)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_PICK (CONTENT_TOOLITEM_MASK | 0x2B)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_SHOVEL (CONTENT_TOOLITEM_MASK | 0x2C)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_AXE (CONTENT_TOOLITEM_MASK | 0x2D)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_SWORD (CONTENT_TOOLITEM_MASK | 0x2E)
|
||||
#define CONTENT_TOOLITEM_MITHRIL_SPEAR (CONTENT_TOOLITEM_MASK | 0x2F)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
/************************************************************************
|
||||
* enchantment.cpp
|
||||
* voxelands - 3d voxel world sandbox game
|
||||
* Copyright (C) Lisa 'darkrose' Milne 2015 <lisa@ltmnet.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
************************************************************************/
|
||||
|
||||
#include "enchantment.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
1 - Aeterna ---
|
||||
1 - +
|
||||
1 - +
|
||||
1 - Velox ---
|
||||
1 - +
|
||||
1 - +
|
||||
1 -
|
||||
1 -
|
||||
1 -
|
||||
1 -
|
||||
1 -
|
||||
1 -
|
||||
1 - Amplius --------
|
||||
1 - Indomitus --- +
|
||||
1 - + +
|
||||
1 - Ignis +
|
||||
*/
|
||||
|
||||
EnchantmentInfo enchantments[ENCHANTMENT_MAX+1];
|
||||
static int enchantment_isinit = 0;
|
||||
|
||||
static void enchantment_init()
|
||||
{
|
||||
EnchantmentInfo *f;
|
||||
uint8_t i;
|
||||
|
||||
for (i=0; i<=ENCHANTMENT_MAX; i++) {
|
||||
f = &enchantments[i];
|
||||
f->type = ENCHANTMENT_NONE;
|
||||
f->level = 0;
|
||||
f->mask = 0;
|
||||
f->overlay = "";
|
||||
f->name = L"";
|
||||
}
|
||||
|
||||
i = ENCHANTMENT_FLAME;
|
||||
f = &enchantments[i];
|
||||
f->type = i;
|
||||
f->mask = (1<<(i-1));
|
||||
f->overlay = "flame";
|
||||
f->name = L"Ignis";
|
||||
|
||||
i = ENCHANTMENT_DONTBREAK;
|
||||
f = &enchantments[i];
|
||||
f->type = i;
|
||||
f->mask = (1<<(i-1));
|
||||
f->overlay = "dontbreak";
|
||||
f->name = L"Indomitus";
|
||||
|
||||
i = ENCHANTMENT_MORE;
|
||||
f = &enchantments[i];
|
||||
f->type = i;
|
||||
f->mask = (1<<(i-1));
|
||||
f->overlay = "more";
|
||||
f->name = L"Amplius";
|
||||
|
||||
i = ENCHANTMENT_FAST;
|
||||
f = &enchantments[i];
|
||||
f->type = i;
|
||||
f->mask = (1<<(i-1));
|
||||
f->overlay = "fast";
|
||||
f->name = L"Velox";
|
||||
|
||||
i = ENCHANTMENT_LONGLASTING;
|
||||
f = &enchantments[i];
|
||||
f->type = i;
|
||||
f->mask = (1<<(i-1));
|
||||
f->overlay = "longlast";
|
||||
f->name = L"Aeterna";
|
||||
|
||||
enchantment_isinit = 1;
|
||||
}
|
||||
|
||||
/* read and remove one enchantment from data,
|
||||
* call repeatedly to iterate over all enchantments */
|
||||
bool enchantment_get(uint16_t *data, EnchantmentInfo *info)
|
||||
{
|
||||
uint16_t d;
|
||||
int8_t i;
|
||||
uint8_t l = 0;
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
printf("enchantment_get( %u , X) - START\n",*data);
|
||||
|
||||
d = *data;
|
||||
if (d == ENCHANTMENT_NONE)
|
||||
return false;
|
||||
|
||||
if (!enchantment_isinit)
|
||||
enchantment_init();
|
||||
|
||||
for (i=15; i>-1; i--) {
|
||||
if ((d&(1<<i)) == 0)
|
||||
continue;
|
||||
if (enchantments[i+1].mask == (1<<i))
|
||||
break;
|
||||
}
|
||||
if (i < 0) {
|
||||
*data = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (i > 2) {
|
||||
d = (d>>(i-2));
|
||||
d &= 0x0003;
|
||||
l = 1+d;
|
||||
}else{
|
||||
l = 1;
|
||||
}
|
||||
|
||||
if (info) {
|
||||
*info = enchantments[i+1];
|
||||
info->level = l;
|
||||
}
|
||||
|
||||
for (d=0; d<3 && i>-1; d++,i--) {
|
||||
(*data) &= ~(1<<i);
|
||||
printf("enchantment_get( %u , X) - TICK %u\n",*data,i);
|
||||
}
|
||||
printf("enchantment_get( %u , X) - END\n",*data);
|
||||
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/************************************************************************
|
||||
* enchantment.cpp
|
||||
* voxelands - 3d voxel world sandbox game
|
||||
* Copyright (C) Lisa 'darkrose' Milne 2015 <lisa@ltmnet.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
************************************************************************/
|
||||
|
||||
#ifndef ENCHANTMENT_HEADER
|
||||
#define ENCHANTMENT_HEADER
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#define ENCHANTMENT_NONE 0
|
||||
#define ENCHANTMENT_FLAME 2
|
||||
#define ENCHANTMENT_DONTBREAK 3
|
||||
#define ENCHANTMENT_MORE 4
|
||||
#define ENCHANTMENT_FAST 13
|
||||
#define ENCHANTMENT_LONGLASTING 16
|
||||
#define ENCHANTMENT_MAX 16
|
||||
|
||||
struct EnchantmentInfo {
|
||||
uint16_t type;
|
||||
uint8_t level;
|
||||
uint16_t mask;
|
||||
std::string overlay;
|
||||
std::wstring name;
|
||||
};
|
||||
|
||||
bool enchantment_get(uint16_t *data, EnchantmentInfo *info);
|
||||
|
||||
#endif
|
|
@ -37,6 +37,7 @@
|
|||
#include "player.h"
|
||||
#include "log.h"
|
||||
#include "intl.h"
|
||||
#include "enchantment.h"
|
||||
|
||||
/*
|
||||
InventoryItem
|
||||
|
@ -237,9 +238,9 @@ float MaterialItem::getFuelTime() const
|
|||
bool MaterialItem::use(ServerEnvironment *env, Player *player)
|
||||
{
|
||||
content_t n = content_features(m_content).onuse_replace_node;
|
||||
if (n != CONTENT_IGNORE) {
|
||||
if (n != CONTENT_IGNORE)
|
||||
m_content = n;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -254,9 +255,22 @@ video::ITexture * CraftItem::getImage() const
|
|||
return NULL;
|
||||
|
||||
std::string name = content_craftitem_features(m_content).texture;
|
||||
std::string base = content_craftitem_features(m_content).overlay_base;
|
||||
|
||||
std::ostringstream os;
|
||||
os<<name;
|
||||
|
||||
if (base != "") {
|
||||
EnchantmentInfo info;
|
||||
u16 data = m_data;
|
||||
while (enchantment_get(&data,&info)) {
|
||||
if (info.overlay != "")
|
||||
os<<"^"<<base<<"_"<<info.overlay<<".png";
|
||||
}
|
||||
}
|
||||
|
||||
// Get such a texture
|
||||
return g_texturesource->getTextureRaw(name);
|
||||
return g_texturesource->getTextureRaw(os.str());
|
||||
}
|
||||
#endif
|
||||
std::wstring CraftItem::getGuiName()
|
||||
|
@ -410,6 +424,24 @@ bool CraftItem::use(ServerEnvironment *env, Player *player)
|
|||
*/
|
||||
|
||||
#ifndef SERVER
|
||||
std::string ToolItem::getBasename() const
|
||||
{
|
||||
std::ostringstream os;
|
||||
os<<content_toolitem_features(m_content).texture;
|
||||
|
||||
EnchantmentInfo info;
|
||||
u16 data = m_data;
|
||||
if (m_content == CONTENT_TOOLITEM_MITHRIL_PICK)
|
||||
data = (1<<15)|(1<<3);
|
||||
while (enchantment_get(&data,&info)) {
|
||||
std::string ol = toolitem_overlay(m_content,info.overlay);
|
||||
if (ol != "")
|
||||
os<<"^"<<ol;
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
video::ITexture *ToolItem::getImage() const
|
||||
{
|
||||
if(g_texturesource == NULL)
|
||||
|
@ -455,6 +487,20 @@ std::wstring ToolItem::getGuiText()
|
|||
sprintf(buff,"%02d",(int)f->fuel_time%60);
|
||||
txt += narrow_to_wide(buff);
|
||||
}
|
||||
//if (m_data > 0) {
|
||||
if (m_content == CONTENT_TOOLITEM_MITHRIL_PICK) {
|
||||
EnchantmentInfo info;
|
||||
u16 data = m_data;
|
||||
txt += L"\n";
|
||||
if (m_content == CONTENT_TOOLITEM_MITHRIL_PICK)
|
||||
data = (1<<15)|(1<<3);
|
||||
while (enchantment_get(&data,&info)) {
|
||||
txt += L"\n";
|
||||
txt += info.name;
|
||||
txt += L" ";
|
||||
txt += itows(info.level);
|
||||
}
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
|
|
@ -382,9 +382,7 @@ public:
|
|||
return new ToolItem(m_content, m_wear, m_data);
|
||||
}
|
||||
#ifndef SERVER
|
||||
std::string getBasename() const {
|
||||
return content_toolitem_features(m_content).texture;
|
||||
}
|
||||
std::string getBasename() const;
|
||||
|
||||
video::ITexture * getImage() const;
|
||||
|
||||
|
|
|
@ -1487,7 +1487,7 @@ void make_block(BlockMakeData *data)
|
|||
PseudoRandom mineralrandom(blockseed);
|
||||
|
||||
/*
|
||||
Add meseblocks
|
||||
Add mithril blocks
|
||||
*/
|
||||
for (s16 i=0; i<approx_ground_depth/4; i++) {
|
||||
if (mineralrandom.next()%50 == 0) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* mineral.cpp
|
||||
* voxelands - 3d voxel world sandbox game
|
||||
* Copyright (C) Lisa 'darkrose' Milne 2014 <lisa@ltmnet.com>
|
||||
* Copyright (C) Lisa 'darkrose' Milne 2015 <lisa@ltmnet.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* mineral.h
|
||||
* voxelands - 3d voxel world sandbox game
|
||||
* Copyright (C) Lisa 'darkrose' Milne 2014 <lisa@ltmnet.com>
|
||||
* Copyright (C) Lisa 'darkrose' Milne 2015 <lisa@ltmnet.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|