summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-09-15 21:26:07 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-09-15 21:26:07 +0200
commitfa901d1cb94cdd47cb066402ae7e478154113306 (patch)
tree369e02549b3facf6aac2c9af3b995df07fa7581d /src
parenta92a2f3255e9b7eabedb8eec7e25cd80e82481fb (diff)
downloadmanaserv-fa901d1cb94cdd47cb066402ae7e478154113306.tar.gz
manaserv-fa901d1cb94cdd47cb066402ae7e478154113306.tar.bz2
manaserv-fa901d1cb94cdd47cb066402ae7e478154113306.tar.xz
manaserv-fa901d1cb94cdd47cb066402ae7e478154113306.zip
Reordered the manaserv.xml.example file and made related code cleanups.
Reviewed-by: Thorbjorn.
Diffstat (limited to 'src')
-rw-r--r--src/account-server/accounthandler.cpp9
-rw-r--r--src/account-server/storage.cpp2
-rw-r--r--src/game-server/being.cpp25
-rw-r--r--src/game-server/character.cpp6
-rw-r--r--src/game-server/commandhandler.cpp30
-rw-r--r--src/game-server/item.cpp2
-rw-r--r--src/game-server/mapcomposite.cpp12
-rw-r--r--src/game-server/monster.cpp2
-rw-r--r--src/game-server/state.cpp6
9 files changed, 55 insertions, 39 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index ce3635b6..28b92024 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -46,7 +46,8 @@
static void addUpdateHost(MessageOut *msg)
{
- std::string updateHost = Configuration::getValue("defaultUpdateHost", "");
+ std::string updateHost = Configuration::getValue("net_defaultUpdateHost",
+ "");
msg->writeString(updateHost);
}
@@ -295,7 +296,7 @@ void AccountHandler::handleLoginMessage(AccountClient &client, MessageIn &msg)
const int clientVersion = msg.readLong();
- if (clientVersion < Configuration::getValue("clientVersion", 0))
+ if (clientVersion < Configuration::getValue("net_clientVersion", 0))
{
reply.writeByte(LOGIN_INVALID_VERSION);
client.send(reply);
@@ -436,7 +437,7 @@ void AccountHandler::handleRegisterMessage(AccountClient &client,
std::string password = msg.readString();
std::string email = msg.readString();
std::string captcha = msg.readString();
- int minClientVersion = Configuration::getValue("clientVersion", 0);
+ int minClientVersion = Configuration::getValue("net_clientVersion", 0);
unsigned minNameLength = Configuration::getValue("account_minNameLength", 4);
unsigned maxNameLength = Configuration::getValue("account_maxNameLength", 15);
@@ -670,7 +671,7 @@ void AccountHandler::handleCharacterCreateMessage(AccountClient &client,
int numGenders = Configuration::getValue("char_numGenders", 2);
unsigned int minNameLength = Configuration::getValue("char_minNameLength", 4);
unsigned int maxNameLength = Configuration::getValue("char_maxNameLength", 25);
- unsigned int maxCharacters = Configuration::getValue("char_maxCharacters", 3);
+ unsigned int maxCharacters = Configuration::getValue("account_maxCharacters", 3);
MessageOut reply(APMSG_CHAR_CREATE_RESPONSE);
diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp
index 323bc587..9d51c641 100644
--- a/src/account-server/storage.cpp
+++ b/src/account-server/storage.cpp
@@ -325,7 +325,7 @@ Character *Storage::getCharacterBySQL(Account *owner)
{
// Set character to default map and one of the default location
// Default map is to be 1, as not found return value will be 0.
- character->setMapId(Configuration::getValue("defaultMap", 1));
+ character->setMapId(Configuration::getValue("char_defaultMap", 1));
}
/* Fill the account-related fields. Last step, as it may require a new
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp
index 599ca1f1..4f552cab 100644
--- a/src/game-server/being.cpp
+++ b/src/game-server/being.cpp
@@ -118,13 +118,18 @@ int Being::damage(Actor *source, const Damage &damage)
{
mHitsTaken.push_back(HPloss);
Attribute &HP = mAttributes.at(ATTR_HP);
- LOG_DEBUG("Being " << getPublicID() << " suffered "<<HPloss<<" damage. HP: "
+ LOG_DEBUG("Being " << getPublicID() << " suffered " << HPloss
+ << " damage. HP: "
<< HP.getModifiedAttribute() << "/"
<< mAttributes.at(ATTR_MAX_HP).getModifiedAttribute());
HP.setBase(HP.getBase() - HPloss);
updateDerivedAttributes(ATTR_HP);
- setTimerSoft(T_B_HP_REGEN, Configuration::getValue("hpRegenBreakAfterHit", 0)); // no HP regen after being hit if this is set.
- } else {
+ // No HP regen after being hit if this is set.
+ setTimerSoft(T_B_HP_REGEN,
+ Configuration::getValue("game_hpRegenBreakAfterHit", 0));
+ }
+ else
+ {
HPloss = 0;
}
@@ -135,8 +140,11 @@ void Being::heal()
{
Attribute &hp = mAttributes.at(ATTR_HP);
Attribute &maxHp = mAttributes.at(ATTR_MAX_HP);
- if (maxHp.getModifiedAttribute() == hp.getModifiedAttribute()) return; // Full hp, do nothing.
- hp.clearMods(); // Reset all modifications present in hp
+ if (maxHp.getModifiedAttribute() == hp.getModifiedAttribute())
+ return; // Full hp, do nothing.
+
+ // Reset all modifications present in hp.
+ hp.clearMods();
hp.setBase(maxHp.getModifiedAttribute());
updateDerivedAttributes(ATTR_HP);
}
@@ -145,9 +153,12 @@ void Being::heal(int gain)
{
Attribute &hp = mAttributes.at(ATTR_HP);
Attribute &maxHp = mAttributes.at(ATTR_MAX_HP);
- if (maxHp.getModifiedAttribute() == hp.getModifiedAttribute()) return; // Full hp, do nothing.
+ if (maxHp.getModifiedAttribute() == hp.getModifiedAttribute())
+ return; // Full hp, do nothing.
+
+ // Cannot go over maximum hitpoints.
hp.setBase(hp.getBase() + gain);
- if (hp.getModifiedAttribute() > maxHp.getModifiedAttribute()) // Cannot go over maximum hitpoints.
+ if (hp.getModifiedAttribute() > maxHp.getModifiedAttribute())
hp.setBase(maxHp.getModifiedAttribute());
updateDerivedAttributes(ATTR_HP);
}
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index c102700a..c228ba4f 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -185,9 +185,9 @@ void Character::respawn()
mAttributes[ATTR_HP].setBase(mAttributes[ATTR_MAX_HP].getModifiedAttribute());
updateDerivedAttributes(ATTR_HP);
// Warp back to spawn point.
- int spawnMap = Configuration::getValue("respawnMap", 1);
- int spawnX = Configuration::getValue("respawnX", 1024);
- int spawnY = Configuration::getValue("respawnY", 1024);
+ int spawnMap = Configuration::getValue("char_respawnMap", 1);
+ int spawnX = Configuration::getValue("char_respawnX", 1024);
+ int spawnY = Configuration::getValue("char_respawnY", 1024);
GameState::enqueueWarp(this, MapManager::getMap(spawnMap), spawnX, spawnY);
}
diff --git a/src/game-server/commandhandler.cpp b/src/game-server/commandhandler.cpp
index eb894b5c..0e6dad6b 100644
--- a/src/game-server/commandhandler.cpp
+++ b/src/game-server/commandhandler.cpp
@@ -931,12 +931,12 @@ static void handleMute(Character *player, std::string &args)
{ Character *other;
int length;
- // get arguments
+ // Get arguments.
std::string character = getArgument(args);
std::string valuestr = getArgument(args);
- // check for valid player
+ // Check for a valid player.
other = getPlayer(character);
if (!other)
{
@@ -944,30 +944,34 @@ static void handleMute(Character *player, std::string &args)
return;
}
- // change the length to an integer
+ // Turn the length back to an integer.
if (valuestr.empty())
- {
- length = Configuration::getValue("defaultMuteLength", 60);
- } else {
+ length = Configuration::getValue("command_defaultMuteLength", 60);
+ else
length = utils::stringToInt(valuestr);
- }
+
if (length < 0)
{
say("Invalid length, using default", player);
- length = Configuration::getValue("defaultMuteLength", 60);
+ length = Configuration::getValue("command_defaultMuteLength", 60);
}
- // mute the player
+ // Mute the player.
other->mute(length);
- // feedback
+ // Feedback.
std::stringstream targetMsg;
std::stringstream userMsg;
if (length > 0)
{
- targetMsg << player->getName() << " muted you for " << length << " seconds.";
- userMsg << "You muted " << other->getName() << " for " << length << " seconds.";
- } else {
+ targetMsg << player->getName() << " muted you for "
+ << length << " seconds.";
+
+ userMsg << "You muted " << other->getName()
+ << " for " << length << " seconds.";
+ }
+ else
+ {
targetMsg << player->getName() << " unmuted you.";
userMsg << "You unmuted " << other->getName() << ".";
}
diff --git a/src/game-server/item.cpp b/src/game-server/item.cpp
index 93b2bc10..d2d2c1d8 100644
--- a/src/game-server/item.cpp
+++ b/src/game-server/item.cpp
@@ -96,7 +96,7 @@ bool ItemClass::useTrigger(Being *itemUser, ItemTriggerType trigger)
Item::Item(ItemClass *type, int amount)
: Actor(OBJECT_ITEM), mType(type), mAmount(amount)
{
- mLifetime = Configuration::getValue("floorItemDecayTime", 0) * 10;
+ mLifetime = Configuration::getValue("game_floorItemDecayTime", 0) * 10;
}
void Item::update()
diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp
index 4aca7efe..fa7a38c6 100644
--- a/src/game-server/mapcomposite.cpp
+++ b/src/game-server/mapcomposite.cpp
@@ -547,14 +547,14 @@ void MapComposite::setMap(Map *m)
mMap = m;
mContent = new MapContent(m);
- std::string sPvP = m->getProperty ("pvp");
+ std::string sPvP = m->getProperty("pvp");
if (sPvP == "")
- sPvP = Configuration::getValue("defaultPvp", "");
-
- if (sPvP == "free") mPvPRules = PVP_FREE;
- else if (sPvP == "none") mPvPRules = PVP_NONE;
- else mPvPRules = PVP_NONE;
+ sPvP = Configuration::getValue("game_defaultPvp", "");
+ if (sPvP == "free")
+ mPvPRules = PVP_FREE;
+ else
+ mPvPRules = PVP_NONE;
}
void MapComposite::update()
diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp
index 85c45336..91737ed1 100644
--- a/src/game-server/monster.cpp
+++ b/src/game-server/monster.cpp
@@ -214,7 +214,7 @@ void Monster::update()
Direction bestAttackDirection = DIRECTION_DOWN;
// Iterate through objects nearby
- int aroundArea = Configuration::getValue("visualRange", 448);
+ int aroundArea = Configuration::getValue("game_visualRange", 448);
for (BeingIterator i(getMap()->getAroundBeingIterator(this, aroundArea)); i; ++i)
{
// We only want to attack player characters
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index fdfd8a43..ee7c95fd 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -164,7 +164,7 @@ static void informPlayer(MapComposite *map, Character *p)
MessageOut damageMsg(GPMSG_BEINGS_DAMAGE);
const Point &pold = p->getOldPosition(), ppos = p->getPosition();
int pid = p->getPublicID(), pflags = p->getUpdateFlags();
- int visualRange = Configuration::getValue("visualRange", 320);
+ int visualRange = Configuration::getValue("game_visualRange", 448);
// Inform client about activities of other beings near its character
for (BeingIterator i(map->getAroundBeingIterator(p, visualRange)); i; ++i)
@@ -608,7 +608,7 @@ void GameState::remove(Thing *ptr)
{
assert(!dbgLockObjects);
MapComposite *map = ptr->getMap();
- int visualRange = Configuration::getValue("visualRange", 320);
+ int visualRange = Configuration::getValue("game_visualRange", 448);
ptr->removed();
@@ -750,7 +750,7 @@ void GameState::enqueueWarp(Character *ptr, MapComposite *m, int x, int y)
void GameState::sayAround(Actor *obj, const std::string &text)
{
Point speakerPosition = obj->getPosition();
- int visualRange = Configuration::getValue("visualRange", 320);
+ int visualRange = Configuration::getValue("game_visualRange", 448);
for (CharacterIterator i(obj->getMap()->getAroundActorIterator(obj, visualRange)); i; ++i)
{