summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/account-server/main-account.cpp12
-rw-r--r--src/game-server/item.cpp16
-rw-r--r--src/game-server/item.h21
-rw-r--r--src/game-server/monstermanager.cpp20
-rw-r--r--src/scripting/lua.cpp7
5 files changed, 37 insertions, 39 deletions
diff --git a/src/account-server/main-account.cpp b/src/account-server/main-account.cpp
index 65c5efd1..ab4df75e 100644
--- a/src/account-server/main-account.cpp
+++ b/src/account-server/main-account.cpp
@@ -365,19 +365,11 @@ int main(int argc, char *argv[])
statTimer.start();
banTimer.start();
- // -------------------------------------------------------------------------
- // FIXME: for testing purposes only...
- // writing accountserver startup time and svn revision to database as global
- // world state variable
- const time_t startup = time(NULL);
+ // Write startup time to database as system world state variable
std::stringstream timestamp;
- timestamp << startup;
+ timestamp << time(NULL);
storage->setWorldStateVar("accountserver_startup", timestamp.str(),
Storage::SystemMap);
- const std::string revision = "$Revision$";
- storage->setWorldStateVar("accountserver_version", revision,
- Storage::SystemMap);
- // -------------------------------------------------------------------------
while (running)
{
diff --git a/src/game-server/item.cpp b/src/game-server/item.cpp
index cfb1cd9a..d568fb29 100644
--- a/src/game-server/item.cpp
+++ b/src/game-server/item.cpp
@@ -100,7 +100,12 @@ void ItemEffectScript::dispell(Being *itemUser)
ItemClass::~ItemClass()
{
- resetEffects();
+ while (mEffects.begin() != mEffects.end())
+ {
+ delete mEffects.begin()->second;
+ mEffects.erase(mEffects.begin());
+ }
+
for (std::vector<AttackInfo *>::iterator it = mAttackInfos.begin(),
it_end = mAttackInfos.end();
it != it_end; ++it)
@@ -109,6 +114,15 @@ ItemClass::~ItemClass()
}
}
+void ItemClass::addEffect(ItemEffectInfo *effect,
+ ItemTriggerType id,
+ ItemTriggerType dispell)
+{
+ mEffects.insert(std::make_pair(id, effect));
+ if (dispell)
+ mDispells.insert(std::make_pair(dispell, effect));
+}
+
bool ItemClass::useTrigger(Being *itemUser, ItemTriggerType trigger)
{
if (!trigger)
diff --git a/src/game-server/item.h b/src/game-server/item.h
index 84583aa6..7004a2d8 100644
--- a/src/game-server/item.h
+++ b/src/game-server/item.h
@@ -265,26 +265,7 @@ class ItemClass
*/
void addEffect(ItemEffectInfo *effect,
ItemTriggerType id,
- ItemTriggerType dispell = ITT_NULL)
- {
- mEffects.insert(std::make_pair(id, effect));
- if (dispell)
- mDispells.insert(std::make_pair(dispell, effect));
- }
-
- void resetEffects()
- {
- while (mEffects.begin() != mEffects.end())
- {
- delete mEffects.begin()->second;
- mEffects.erase(mEffects.begin());
- }
- while (mDispells.begin() != mDispells.end())
- {
- delete mDispells.begin()->second;
- mDispells.erase(mDispells.begin());
- }
- }
+ ItemTriggerType dispell = ITT_NULL);
unsigned short mDatabaseID; /**< Item reference information */
std::string mName; /**< name used to identify the item class */
diff --git a/src/game-server/monstermanager.cpp b/src/game-server/monstermanager.cpp
index e0b45bad..cfe540d8 100644
--- a/src/game-server/monstermanager.cpp
+++ b/src/game-server/monstermanager.cpp
@@ -98,12 +98,26 @@ void MonsterManager::initialize()
if (xmlStrEqual(subnode->name, BAD_CAST "drop"))
{
MonsterDrop drop;
- drop.item = itemManager->getItem(
- XML::getProperty(subnode, "item", 0));
+ std::string item = XML::getProperty(subnode, "item",
+ std::string());
+ ItemClass *itemClass;
+ if (utils::isNumeric(item))
+ itemClass = itemManager->getItem(utils::stringToInt(item));
+ else
+ itemClass = itemManager->getItemByName(item);
+
+ if (!itemClass)
+ {
+ LOG_WARN("Monster Manager: Invalid item name \"" << item
+ << "\"");
+ break;
+ }
+
+ drop.item = itemClass;
drop.probability = XML::getFloatProperty(subnode, "percent",
0.0) * 100 + 0.5;
- if (drop.item && drop.probability)
+ if (drop.probability)
drops.push_back(drop);
}
else if (xmlStrEqual(subnode->name, BAD_CAST "attributes"))
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index dfb69d49..1828e515 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -556,7 +556,7 @@ static int chr_get_equipment(lua_State *s)
}
/**
- * chr_inv_change(Character*, (int id || string name,
+ * chr_inv_change(Character*, (int id || string name || itemclass item,
* int nb)...): bool success
* Callback for inserting/removing items in inventory.
* The function can be called several times in a row, but it is better to
@@ -564,10 +564,7 @@ static int chr_get_equipment(lua_State *s)
* (negative amount) should be passed first, then insertions (positive amount).
* If a removal fails, all the previous operations are canceled (except for
* items dropped on the floor, hence why removals should be passed first), and
- * the function returns false. Otherwise the function will return true.
- * Note that previously when the item identifier was zero, money was modified;
- * however currency is now handled through attributes. This breaks backwards
- * compatibility with old scripts, and so logs a warning.
+ * the function returns false.
* Note: If an insertion fails, extra items are dropped on the floor.
*/
static int chr_inv_change(lua_State *s)