diff options
-rw-r--r-- | docs/manaserv.xml.example | 175 | ||||
-rw-r--r-- | src/account-server/accounthandler.cpp | 9 | ||||
-rw-r--r-- | src/account-server/storage.cpp | 2 | ||||
-rw-r--r-- | src/game-server/being.cpp | 25 | ||||
-rw-r--r-- | src/game-server/character.cpp | 6 | ||||
-rw-r--r-- | src/game-server/commandhandler.cpp | 30 | ||||
-rw-r--r-- | src/game-server/item.cpp | 2 | ||||
-rw-r--r-- | src/game-server/mapcomposite.cpp | 12 | ||||
-rw-r--r-- | src/game-server/monster.cpp | 2 | ||||
-rw-r--r-- | src/game-server/state.cpp | 6 |
10 files changed, 188 insertions, 81 deletions
diff --git a/docs/manaserv.xml.example b/docs/manaserv.xml.example index 13fed85..1faea92 100644 --- a/docs/manaserv.xml.example +++ b/docs/manaserv.xml.example @@ -52,14 +52,26 @@ TODO! --> -<!-- end of database configuration *************************************** --> +<!-- end of database configuration **************************************** --> +<!-- Paths configuration ****************************************************** + Set here the different paths used by both the server to find data. +--> <!-- Paths to data files --> <option name="serverPath" value="." /> <option name="clientDataPath" value="example/clientdata" /> <option name="serverDataPath" value="example/serverdata" /> - <!-- Log output configuration --> +<!-- end of paths configuration ******************************************* --> + +<!-- Logs configuration ******************************************************* + Set here the different paths used by both the server + to store statistics and log files. +--> + + <!-- + Log output configuration, relative to the folders where the servers were ran. + --> <option name="log_statisticsFile" value="./manaserv.stats"/> <option name="log_accountServerFile" value="./manaserv-account.log"/> <option name="log_gameServerFile" value="./manaserv-game.log"/> @@ -76,17 +88,12 @@ <option name="log_gameServerLogLevel" value="2"/> <option name="log_accountServerLogLevel" value="2"/> - <!-- - New player starting location. The map should be defined in data/maps.xml. - --> - <option name="char_startMap" value="1"/> - <option name="char_startX" value="720"/> - <option name="char_startY" value="840"/> +<!-- end of logs configuration ****************************************** --> - <!-- Respawn options --> - <option name="respawnMap" value="4"/> - <option name="respawnX" value="1000"/> - <option name="respawnY" value="1000"/> +<!-- Network options configuration ******************************************** + Set here the different network-related options to set up the servers + hosts and ports, for instance. +--> <!-- ATTENTION: This is a very important option! @@ -99,79 +106,163 @@ <!-- The game server uses this address to connect to the account server. Clients will also need to be able to connect to the account server. + Don't use the 'localhost' value when running a public server, + but rather the public name. --> <option name="net_accountServerAddress" value="localhost"/> <option name="net_accountServerPort" value="9601"/> <!-- The clients use this address to connect to a game server on this machine. + Don't use the 'localhost' value when running a public server, + but rather the public name. --> <option name="net_gameServerAddress" value="localhost"/> <option name="net_gameServerPort" value="9604"/> - <!-- Max connected clients allowed. --> - <option name="net_maxClients" value="1000"/> - <!-- Host the account server will listen to. Defaulted to 'localhost'. + Don't use the 'localhost' value when running a public server, + but rather the public name. TODO: Replace with full listening config for both host and port for the chat and game servers. --> <option name="net_listenHost" value=""/> - <!-- Minimal supported mana client version --> - <option name="clientVersion" value="0" /> - - <!-- Gameplay-related config options --> - <option name="visualRange" value="448"/> - <option name="floorItemDecayTime" value="10" /> - <option name="hpRegenBreakAfterHit" value="50" /> - <option name="defaultPvp" value="free" /> - - <!-- Default Map id at character loading --> - <option name="defaultMap" value="1" /> - <!-- Update host url: E.g.: "http://www.manasource.org/updates" It gives the http folder where the update files can be downloaded. --> - <option name="defaultUpdateHost" value="" /> + <option name="net_defaultUpdateHost" value="" /> + + <!-- + Minimal supported mana client version. + The current version is 0. + --> + <option name="net_clientVersion" value="0" /> + + <!-- Max connected clients allowed. --> + <option name="net_maxClients" value="1000"/> + +<!-- end of network options configuration ********************************* --> + +<!-- Accounts configuration *************************************************** + Set here the different options related to players accounts + and used at their creation. +--> - <!-- Account-creation-related config options --> <option name="account_allowRegister" value="1" /> - <option name="account_denyRegisterReason" value="The server administrator has disabled automatic registration!" /> + <option name="account_denyRegisterReason" + value="The server administrator has disabled automatic registration!"/> <option name="account_minEmailLength" value="7" /> <option name="account_maxEmailLength" value="128" /> <option name="account_minNameLength" value="4" /> <option name="account_maxNameLength" value="16" /> <option name="account_minPasswordLength" value="6" /> <option name="account_maxPasswordLength" value="25" /> + <option name="account_maxCharacters" value="3" /> + +<!-- end of accounts configuration **************************************** --> + +<!-- Characters configuration ************************************************* + Set here the different options related to players characters. +--> - <!-- Character-creation-related config options --> <option name="char_numHairStyles" value="17" /> <option name="char_numHairColors" value="9" /> <option name="char_numGenders" value="2" /> <option name="char_minNameLength" value="4" /> <option name="char_maxNameLength" value="25" /> - <option name="char_maxCharacters" value="3" /> - <!-- Chat-related config options --> + <!-- + New player starting location. The map should be defined in data/maps.xml. + --> + <option name="char_startMap" value="1"/> + <!-- + Respawn coordinates on the start map: + In pixels, not in tiles. + --> + <option name="char_startX" value="720"/> + <option name="char_startY" value="840"/> + + <!-- Respawn options --> + <option name="char_respawnMap" value="4"/> + <!-- + Respawn coordinates on the respawn map: + In pixels, not in tiles. + --> + <option name="char_respawnX" value="1000"/> + <option name="char_respawnY" value="1000"/> + + <!-- Default Map id at character loading --> + <option name="char_defaultMap" value="1" /> + +<!-- end of characters configuration ************************************** --> + +<!-- Game configuration ************************************************* + Set here the different options related to the gameplay. +--> + + <!-- + Set the player's character visual range around him in pixels. + Monsters and other beings further than this value won't appear in its sight. + --> + <option name="game_visualRange" value="448"/> + <!-- + The time in seconds an item standing on the floor will remain before vanishing. + Set it to 0 to disable it. + --> + <option name="game_floorItemDecayTime" value="10" /> + + <!-- + Set how much time the auto-regeneration is stopped when hurt. + (in 1/10th seconds.) + --> + <option name="game_hpRegenBreakAfterHit" value="50" /> + + <!-- + Default PVP (Player-versus-player) rule on a map not setting this property. + Values available: none (No PVP), free (All PVP). + --> + <option name="game_defaultPvp" value="free" /> + +<!-- end of game configuration ******************************************** --> + +<!-- Commands configuration *************************************************** + Set here the different options related to chat commands. +--> + + <!-- + Default mute command length (in seconds.) + --> + <option name="command_defaultMuteLength" value="60" /> + +<!-- end of commands configuration **************************************** --> + +<!-- Chat configuration *************************************************** + Set here the different options related to chat handling. +--> + <option name="chat_maxChannelNameLength" value="15" /> - <!-- I noticed the following configuration-like enumeration values which are never checked: - //chat-related - MAX_PUBLIC_CHANNELS_RANGE = 1000, + + <!-- + TODO: Dehard-code those values, or redo the chat channeling system + to not make use of them. + MAX_PUBLIC_CHANNELS_RANGE = 1000, MAX_PRIVATE_CHANNELS_RANGE = 10000, MAX_CHANNEL_ANNOUNCEMENT = 150, MAX_CHANNEL_PASSWORD = 12, - --> + --> + +<!-- end of chat configuration ******************************************** --> + +<!-- Mail configuration *************************************************** + Set here the different options related to the mail system. +--> - <!-- Mail-system related--> <option name="mail_maxAttachments" value="3" /> <option name="mail_maxLetters" value="10" /> - <!-- Command defaults --> - - <!-- Default mute command length (in seconds.) --> - <option name="defaultMuteLength" value="60" /> +<!-- end of mail configuration ******************************************** --> </configuration> diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp index ce3635b..28b9202 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 323bc58..9d51c64 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 599ca1f..4f552ca 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 c102700..c228ba4 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 eb894b5..0e6dad6 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 93b2bc1..d2d2c1d 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 4aca7ef..fa7a38c 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 85c4533..91737ed 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 fdfd8a4..ee7c95f 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) { |