Merge remote-tracking branch 'scrawl/master'

deque
Marc Zinnschlag 10 years ago
commit 65ddf7acfe

@ -787,6 +787,10 @@ std::string magicEffectFlags(int flags)
if (flags & ESM::MagicEffect::NonRecastable) properties += "NonRecastable ";
if (flags & ESM::MagicEffect::Unreflectable) properties += "Unreflectable ";
if (flags & ESM::MagicEffect::CasterLinked) properties += "CasterLinked ";
if (flags & ESM::MagicEffect::AllowSpellmaking) properties += "AllowSpellmaking ";
if (flags & ESM::MagicEffect::AllowEnchanting) properties += "AllowEnchanting ";
if (flags & ESM::MagicEffect::NegativeLight) properties += "NegativeLight ";
if (flags & 0xFFFC0000) properties += "Invalid ";
properties += str(boost::format("(0x%08X)") % flags);
return properties;

@ -8,6 +8,8 @@
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/magiceffects.hpp"
#include "../mwworld/class.hpp"
#include "inventoryitemmodel.hpp"
@ -201,22 +203,26 @@ namespace MWGui
ingredient->setUserString("ToolTipType", "ItemPtr");
ingredient->setUserData(item);
MyGUI::TextBox* text = ingredient->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(0, 14, 32, 18), MyGUI::Align::Default, std::string("Label"));
text->setTextAlign(MyGUI::Align::Right);
text->setNeedMouseFocus(false);
text->setTextShadow(true);
text->setTextShadowColour(MyGUI::Colour(0,0,0));
text->setCaption(ItemView::getCountString(ingredient->getUserData<MWWorld::Ptr>()->getRefData().getCount()));
ingredient->setCount(ingredient->getUserData<MWWorld::Ptr>()->getRefData().getCount());
}
mItemView->update();
std::vector<ESM::ENAMstruct> effects;
ESM::EffectList list;
list.mList = effects;
for (MWMechanics::Alchemy::TEffectsIterator it = mAlchemy.beginEffects (); it != mAlchemy.endEffects (); ++it)
std::set<MWMechanics::EffectKey> effectIds = mAlchemy.listEffects();
Widgets::SpellEffectList list;
for (std::set<MWMechanics::EffectKey>::iterator it = effectIds.begin(); it != effectIds.end(); ++it)
{
list.mList.push_back(*it);
Widgets::SpellEffectParams params;
params.mEffectID = it->mId;
const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(it->mId);
if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetSkill)
params.mSkill = it->mArg;
else if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
params.mAttribute = it->mArg;
params.mIsConstant = true;
params.mNoTarget = true;
list.push_back(params);
}
while (mEffectsBox->getChildCount())
@ -226,8 +232,7 @@ namespace MWGui
Widgets::MWEffectListPtr effectsWidget = mEffectsBox->createWidget<Widgets::MWEffectList>
("MW_StatName", coord, MyGUI::Align::Left | MyGUI::Align::Top);
Widgets::SpellEffectList _list = Widgets::MWEffectList::effectListFromESM(&list);
effectsWidget->setEffectList(_list);
effectsWidget->setEffectList(list);
std::vector<MyGUI::Widget*> effectItems;
effectsWidget->createEffectWidgets(effectItems, mEffectsBox, coord, false, 0);

@ -92,16 +92,7 @@ namespace MWGui
mDraggedWidget = baseWidget;
baseWidget->setItem(mItem.mBase);
baseWidget->setNeedMouseFocus(false);
// text widget that shows item count
// TODO: move to ItemWidget
MyGUI::TextBox* text = baseWidget->createWidget<MyGUI::TextBox>("SandBrightText",
MyGUI::IntCoord(0, 14, 32, 18), MyGUI::Align::Default, std::string("Label"));
text->setTextAlign(MyGUI::Align::Right);
text->setNeedMouseFocus(false);
text->setTextShadow(true);
text->setTextShadowColour(MyGUI::Colour(0,0,0));
text->setCaption(ItemView::getCountString(count));
baseWidget->setCount(count);
sourceView->update();

@ -17,16 +17,6 @@
namespace MWGui
{
std::string ItemView::getCountString(int count)
{
if (count == 1)
return "";
if (count > 9999)
return boost::lexical_cast<std::string>(int(count/1000.f)) + "k";
else
return boost::lexical_cast<std::string>(count);
}
ItemView::ItemView()
: mModel(NULL)
, mScrollView(NULL)
@ -123,19 +113,10 @@ void ItemView::update()
if (item.mType == ItemStack::Type_Equipped)
state = ItemWidget::Equip;
itemWidget->setItem(item.mBase, state);
itemWidget->setCount(item.mCount);
itemWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemView::onSelectedItem);
itemWidget->eventMouseWheel += MyGUI::newDelegate(this, &ItemView::onMouseWheel);
// text widget that shows item count
// TODO: move to ItemWidget
MyGUI::TextBox* text = itemWidget->createWidget<MyGUI::TextBox>("SandBrightText",
MyGUI::IntCoord(5, 19, 32, 18), MyGUI::Align::Default, std::string("Label"));
text->setTextAlign(MyGUI::Align::Right);
text->setNeedMouseFocus(false);
text->setTextShadow(true);
text->setTextShadowColour(MyGUI::Colour(0,0,0));
text->setCaption(getCountString(item.mCount));
}
layoutWidgets();

@ -30,8 +30,6 @@ namespace MWGui
void update();
static std::string getCountString(int count);
private:
virtual void initialiseOverride();

@ -2,16 +2,34 @@
#include <MyGUI_FactoryManager.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_TextBox.h>
#include <boost/lexical_cast.hpp>
#include <components/misc/resourcehelpers.hpp>
#include "../mwworld/class.hpp"
namespace
{
std::string getCountString(int count)
{
if (count == 1)
return "";
if (count > 9999)
return boost::lexical_cast<std::string>(int(count/1000.f)) + "k";
else
return boost::lexical_cast<std::string>(count);
}
}
namespace MWGui
{
ItemWidget::ItemWidget()
: mItem(NULL)
, mFrame(NULL)
, mText(NULL)
{
}
@ -29,10 +47,20 @@ namespace MWGui
assignWidget(mFrame, "Frame");
if (mFrame)
mFrame->setNeedMouseFocus(false);
assignWidget(mText, "Text");
if (mText)
mText->setNeedMouseFocus(false);
Base::initialiseOverride();
}
void ItemWidget::setCount(int count)
{
if (!mText)
return;
mText->setCaption(getCountString(count));
}
void ItemWidget::setIcon(const std::string &icon)
{
if (mItem)

@ -29,6 +29,9 @@ namespace MWGui
Magic
};
/// Set count to be displayed in a textbox over the item
void setCount(int count);
/// \a ptr may be empty
void setItem (const MWWorld::Ptr& ptr, ItemState state = None);
@ -42,6 +45,7 @@ namespace MWGui
MyGUI::ImageBox* mItem;
MyGUI::ImageBox* mFrame;
MyGUI::TextBox* mText;
};
}

@ -397,8 +397,14 @@ namespace MWMechanics
int agility = creatureStats.getAttribute(ESM::Attribute::Agility).getModified();
int endurance = creatureStats.getAttribute(ESM::Attribute::Endurance).getModified();
double magickaFactor =
creatureStats.getMagicEffects().get (EffectKey (ESM::MagicEffect::FortifyMaximumMagicka)).getMagnitude() * 0.1 + 1;
float base = 1.f;
if (ptr.getCellRef().getRefId() == "player")
base = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fPCbaseMagickaMult")->getFloat();
else
base = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCbaseMagickaMult")->getFloat();
double magickaFactor = base +
creatureStats.getMagicEffects().get (EffectKey (ESM::MagicEffect::FortifyMaximumMagicka)).getMagnitude() * 0.1;
DynamicStat<float> magicka = creatureStats.getMagicka();
float diff = (static_cast<int>(magickaFactor*intelligence)) - magicka.getBase();

@ -27,7 +27,7 @@ namespace MWMechanics
, mCellX(std::numeric_limits<int>::max())
, mCellY(std::numeric_limits<int>::max())
{
mMaxDist = 470;
mMaxDist = 450;
// The CS Help File states that if a duration is given, the AI package will run for that long
// BUT if a location is givin, it "trumps" the duration so it will simply escort to that location.
@ -40,7 +40,7 @@ namespace MWMechanics
, mCellX(std::numeric_limits<int>::max())
, mCellY(std::numeric_limits<int>::max())
{
mMaxDist = 470;
mMaxDist = 450;
// The CS Help File states that if a duration is given, the AI package will run for that long
// BUT if a location is given, it "trumps" the duration so it will simply escort to that location.
@ -93,14 +93,14 @@ namespace MWMechanics
{
if(pathTo(actor,ESM::Pathgrid::Point(mX,mY,mZ),duration)) //Returns true on path complete
return true;
mMaxDist = 470;
mMaxDist = 450;
}
else
{
// Stop moving if the player is to far away
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(actor, "idle3", 0, 1);
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
mMaxDist = 330;
mMaxDist = 250;
}
return false;

@ -306,6 +306,9 @@ float MWMechanics::Alchemy::getChance() const
const CreatureStats& creatureStats = mAlchemist.getClass().getCreatureStats (mAlchemist);
const NpcStats& npcStats = mAlchemist.getClass().getNpcStats (mAlchemist);
if (beginEffects() == endEffects())
return 0.f;
return
(npcStats.getSkill (ESM::Skill::Alchemy).getModified() +
0.1 * creatureStats.getAttribute (1).getModified()
@ -450,7 +453,7 @@ MWMechanics::Alchemy::Result MWMechanics::Alchemy::create (const std::string& na
if (name.empty() && getPotionName().empty())
return Result_NoName;
if (beginEffects()==endEffects())
if (listEffects().empty())
return Result_NoEffects;
if (getChance()<std::rand()/static_cast<double> (RAND_MAX)*100)

@ -50,15 +50,12 @@ namespace MWMechanics
TEffectsContainer mEffects;
int mValue;
std::set<EffectKey> listEffects() const;
///< List all effects shared by at least two ingredients.
void applyTools (int flags, float& value) const;
void updateEffects();
const ESM::Potion *getRecord() const;
///< Return existing recrod for created potion (may return 0)
///< Return existing record for created potion (may return 0)
void removeIngredients();
///< Remove selected ingredients from alchemist's inventory, cleanup selected ingredients and
@ -75,6 +72,10 @@ namespace MWMechanics
int countIngredients() const;
TEffectsIterator beginEffects() const;
TEffectsIterator endEffects() const;
public:
void setAlchemist (const MWWorld::Ptr& npc);
@ -94,6 +95,9 @@ namespace MWMechanics
void clear();
///< Remove alchemist, tools and ingredients.
std::set<EffectKey> listEffects() const;
///< List all effects shared by at least two ingredients.
int addIngredient (const MWWorld::Ptr& ingredient);
///< Add ingredient into the next free slot.
///
@ -103,10 +107,6 @@ namespace MWMechanics
void removeIngredient (int index);
///< Remove ingredient from slot (calling this function on an empty slot is a no-op).
TEffectsIterator beginEffects() const;
TEffectsIterator endEffects() const;
std::string getPotionName() const;
///< Return the name of the potion that would be created when calling create (if a record for such
/// a potion already exists) or return an empty string.

@ -58,6 +58,7 @@ void Store<ESM::Cell>::load(ESM::ESMReader &esm, const std::string &id)
// merge new cell into old cell
// push the new references on the list of references to manage (saveContext = true)
oldcell->mData = cell.mData;
oldcell->mName = cell.mName; // merge name just to be sure (ID will be the same, but case could have been changed)
oldcell->loadCell(esm, true);
} else
{
@ -74,6 +75,7 @@ void Store<ESM::Cell>::load(ESM::ESMReader &esm, const std::string &id)
if (oldcell) {
// merge new cell into old cell
oldcell->mData = cell.mData;
oldcell->mName = cell.mName;
oldcell->loadCell(esm, false);
// handle moved ref (MVRF) subrecords

@ -3,14 +3,12 @@
<MyGUI type="Skin">
<Skin name="MW_DispEdit" size="10 10">
<!--Property key="Pointer" value="beam" /-->
<BasisSkin type="EditText" offset="0 0 10 10" align="Stretch"/>
</Skin>
<Skin name="MW_DispositionEdit" size="0 0 50 50">
<Property key="FontName" value="Default"/>
<Property key="TextAlign" value="Center"/>
<Property key="Colour" value="0000FF"/>
<Property key="Static" value="1"/>
<Property key="WordWrap" value="true"/>
<Property key="TextShadow" value="true"/>

@ -5,7 +5,6 @@
<Property key="FontName" value="Default"/>
<Property key="TextAlign" value="Left Top"/>
<Property key="TextColour" value="0 0 0"/>
<!--Property key="Pointer" value="beam" /-->
<BasisSkin type="EditText" offset="0 0 10 10" align="Stretch"/>
</Skin>

@ -166,32 +166,6 @@
</Skin>
<Skin name="MW_MultiSubList" size="516 516" align="Left Top">
<Property key="NeedKey" value="true"/>
<Property key="SkinLine" value="MW_ListLine"/>
<Property key="HeightLine" value="20"/>
<Child type="Widget" skin="MW_Box" offset="0 0 516 516" align="Stretch"/>
<Child type="MWScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="Right VStretch" name="VScroll"/>
<Child type="Widget" skin="Default" offset="3 3 493 509" align="Stretch" name="Client"/>
</Skin>
<Skin name="MW_MultiList" size="516 516" align="Left Top">
<Property key="NeedKey" value="true"/>
<Property key="SkinButton" value="ButtonSmall"/>
<Property key="_SkinButtonEmpty" value="EditBox"/>
<Property key="HeightButton" value="20"/>
<Property key="SkinList" value="MW_MultiSubList"/>
<Child type="Widget" skin="MW_Box" offset="0 0 516 516" align="Stretch"/>
<Child type="Widget" skin="" offset="3 3 516 516" align="Stretch" name="Client"/>
</Skin>
<!-- Horizontal line -->
<Skin name="MW_HLine" size="512 10" texture="textures\menu_thin_border_top.dds">

@ -322,6 +322,10 @@
<Resource type="ResourceLayout" name="MW_ItemIcon" version="3.2.0">
<Widget type="Widget" skin="" position="0 0 42 42" name="Root">
<Widget type="ImageBox" skin="ImageBox" position="0 0 42 42" align="Stretch" name="Frame">
<Widget type="TextBox" skin="SandBrightText" position="5 19 32 18" align="Right Bottom" name="Text">
<Property key="TextAlign" value="Right"/>
<Property key="TextShadow" value="true"/>
</Widget>
<Widget type="ImageBox" skin="ImageBox" position="5 5 32 32" align="Stretch" name="Item"/>
</Widget>
</Widget>
@ -338,6 +342,10 @@
<Resource type="ResourceLayout" name="MW_ItemIconBox" version="3.2.0">
<Widget type="Widget" skin="" position="0 0 50 50" name="Root">
<Widget type="ImageBox" skin="ImageBox" position="4 4 42 42" align="Center" name="Frame">
<Widget type="TextBox" skin="SandBrightText" position="5 19 32 18" align="Right Bottom" name="Text">
<Property key="TextAlign" value="Right"/>
<Property key="TextShadow" value="true"/>
</Widget>
<Widget type="ImageBox" skin="ImageBox" position="5 5 32 32" align="Center" name="Item"/>
</Widget>

Loading…
Cancel
Save