summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorFreeyorp <Freeyorp101@hotmail.com>2010-05-17 20:55:06 +1200
committerFreeyorp <Freeyorp101@hotmail.com>2010-07-10 21:51:07 +1200
commit98cdcb1de4f422255aa5ef924042ae7d00a5b968 (patch)
tree1746776580502fb007581f171fa89638ab6bc64f /src/utils
parent26d8eba0ad906cd9b4a95bbd94fc1556719fd5d2 (diff)
downloadmanaserv-98cdcb1de4f422255aa5ef924042ae7d00a5b968.tar.gz
manaserv-98cdcb1de4f422255aa5ef924042ae7d00a5b968.tar.xz
manaserv-98cdcb1de4f422255aa5ef924042ae7d00a5b968.zip
New attribute system and major changes to many low-level areas.
Attribute system: Structure is no longer completely hardcoded. Attributes and structure is defined by new xml file (defaulting to stats.xml) Structure defines non-base modifications to an attribute, to be used by modifiers from items, effects, etc. Calculating the base value for core attributes is still done in C++ (and for such fundamental elements the only reason I can think of to do it any other way is perhaps being able to quickly change scripts without a compile could be useful for testing, but such things are a low priority anyway) Item structure: Modifiers are now through triggers rather than single events. This also removes hardcoded types - an item could be both able to be equipped and be able to be activated. Item activation no longer consumes by default, this must be specified by the property <consumes /> inside the trigger. Currently only attribute modifications, autoattacks, and consumes are defined as effects, but stubs for others do exist. Autoattacks are currently non-functional, and this should be rectified with some urgency. Auto Attacks: AutoAttacks are now separate entities, though not fully complete, nor fully integrated with all beings yet. Integration with the Character class is urgent, integration with other Being children less so. When fully integrated this will allow for multiple autoattacks, through equipping multiple items with this as an equip effect or even through other means if needed. Equipment structure: As ItemClass types are no longer hardcoded, so too are equip types. An item have multiple ways to be equipped across multiple equipment slots with any number in each slot. Character maximums are global but configurable. Miscellaneous: Speed, money, and weight are now attributes. Some managers have been changed into classes such that their associated classes can have them as friends, to avoid (ab)use of public accessors. The serialise procedure should also be set as a friend of Character (both in the account- and game- server) as well; having public accessors returning iterators is simply ridiculous. Some start for such cleanups have been made, but this is not the primary focus here. Significant work will need to be done before this is resolved completely, but the start is there. BuySell::registerPlayerItems() has been completely disabled temporarily. The previous function iterated through equipment, yet in the context I think it is intended to fill items? I have been unable to update this function to fit the modifications made to the Inventory/Equipment/Possessions, as I am unsure what exactly what it should be doing. ItemClass::mSpriteId was previously unused, so had been removed, but I notice that it was used when transmitting equipment to nearby clients. Experimentation showed that this value was never set to anything other than 0, and so has been left out of the ItemManager rewrite. I am not entirely sure what is happening here, but it should be worth looking into at a later time, as I am not sure how equipment appearences would be sent otherwise.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/logger.cpp6
-rw-r--r--src/utils/speedconv.cpp31
-rw-r--r--src/utils/speedconv.hpp44
3 files changed, 81 insertions, 0 deletions
diff --git a/src/utils/logger.cpp b/src/utils/logger.cpp
index a8d7241..71f92a8 100644
--- a/src/utils/logger.cpp
+++ b/src/utils/logger.cpp
@@ -107,9 +107,15 @@ void Logger::output(const std::string &msg, Level atVerbosity)
{
static const char *prefixes[] =
{
+#ifdef T_COL_LOG
+ "[\033[45mFTL\033[0m]",
+ "[\033[41mERR\033[0m]",
+ "[\033[43mWRN\033[0m]",
+#else
"[FTL]",
"[ERR]",
"[WRN]",
+#endif
"[INF]",
"[DBG]"
};
diff --git a/src/utils/speedconv.cpp b/src/utils/speedconv.cpp
new file mode 100644
index 0000000..14d328f
--- /dev/null
+++ b/src/utils/speedconv.cpp
@@ -0,0 +1,31 @@
+/*
+ * The Mana Server
+ * Copyright (C) 2004-2010 The Mana World Development Team
+ *
+ * This file is part of The Mana Server.
+ *
+ * The Mana Server 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 2 of the License, or
+ * any later version.
+ *
+ * The Mana Server 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 The Mana Server. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "utils/speedconv.hpp"
+
+double utils::tpsToSpeed(double tps)
+{
+ return (32000 / (tps * DEFAULT_TILE_LENGTH));
+}
+
+double utils::speedToTps(double speed)
+{
+ return (32000 / (speed * DEFAULT_TILE_LENGTH));
+}
diff --git a/src/utils/speedconv.hpp b/src/utils/speedconv.hpp
new file mode 100644
index 0000000..6a29d0f
--- /dev/null
+++ b/src/utils/speedconv.hpp
@@ -0,0 +1,44 @@
+/*
+ * The Mana Server
+ * Copyright (C) 2004-2010 The Mana World Development Team
+ *
+ * This file is part of The Mana Server.
+ *
+ * The Mana Server 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 2 of the License, or
+ * any later version.
+ *
+ * The Mana Server 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 The Mana Server. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SPEEDCONV_HPP
+#define SPEEDCONV_HPP
+
+// Simple helper functions for converting between tiles per
+// second and the internal speed representation
+
+#include "defines.h"
+
+namespace utils {
+ /**
+ * tpsToSpeed()
+ * @param tps The speed value in tiles per second
+ * @returns The speed value in the internal representation
+ */
+ double tpsToSpeed(double);
+ /**
+ * speedToTps()
+ * @param speed The speed value in the internal representation
+ * @returns The speed value in tiles per second
+ */
+ double speedToTps(double);
+}
+
+#endif // SPEEDCONV_HPP