summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/account-server/accounthandler.cpp101
-rw-r--r--src/common/manaserv_protocol.h2
-rw-r--r--src/game-server/character.cpp8
-rw-r--r--src/game-server/character.h1
-rw-r--r--src/game-server/inventory.cpp9
-rw-r--r--src/game-server/monstermanager.cpp7
6 files changed, 57 insertions, 71 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index 9901300e..a65d8240 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -692,8 +692,7 @@ void AccountHandler::handleCharacterCreateMessage(AccountClient &client,
// Avoid creation of character from old clients.
int slot = -1;
- if (msg.getUnreadLength() > 7)
- slot = msg.readInt8();
+ slot = msg.readInt8();
MessageOut reply(APMSG_CHAR_CREATE_RESPONSE);
@@ -759,76 +758,48 @@ void AccountHandler::handleCharacterCreateMessage(AccountClient &client,
// Customization of character's attributes...
std::vector<int> attributes = std::vector<int>(mModifiableAttributes.size(), 0);
for (unsigned i = 0; i < mModifiableAttributes.size(); ++i)
- attributes[i] = msg.readInt16();
+ attributes[i] = 5;
- int totalAttributes = 0;
+ Character *newCharacter = new Character(name);
+
+ // Set the initial attributes provided by the client
for (unsigned i = 0; i < mModifiableAttributes.size(); ++i)
{
- // For good total attributes check.
- totalAttributes += attributes.at(i);
-
- // For checking if all stats are >= min and <= max.
- if (attributes.at(i) < mAttributeMinimum
- || attributes.at(i) > mAttributeMaximum)
- {
- reply.writeInt8(CREATE_ATTRIBUTES_OUT_OF_RANGE);
- client.send(reply);
- return;
- }
+ newCharacter->mAttributes.insert(
+ std::make_pair(mModifiableAttributes.at(i), attributes[i]));
}
- if (totalAttributes > mStartingPoints)
- {
- reply.writeInt8(CREATE_ATTRIBUTES_TOO_HIGH);
- }
- else if (totalAttributes < mStartingPoints)
- {
- reply.writeInt8(CREATE_ATTRIBUTES_TOO_LOW);
- }
- else
- {
- Character *newCharacter = new Character(name);
+ newCharacter->mAttributes.insert(mDefaultAttributes.begin(),
+ mDefaultAttributes.end());
+ newCharacter->setAccount(acc);
+ newCharacter->setCharacterSlot(slot);
+ newCharacter->setGender(gender);
+ newCharacter->setHairStyle(hairStyle);
+ newCharacter->setHairColor(hairColor);
+ newCharacter->setMapId(Configuration::getValue("char_startMap", 1));
+ Point startingPos(Configuration::getValue("char_startX", 1024),
+ Configuration::getValue("char_startY", 1024));
+ newCharacter->setPosition(startingPos);
+ acc->addCharacter(newCharacter);
+
+ LOG_INFO("Character " << name << " was created for "
+ << acc->getName() << "'s account.");
+
+ storage->flush(acc); // flush changes
+
+ // log transaction
+ Transaction trans;
+ trans.mCharacterId = newCharacter->getDatabaseID();
+ trans.mAction = TRANS_CHAR_CREATE;
+ trans.mMessage = acc->getName() + " created character ";
+ trans.mMessage.append("called " + name);
+ storage->addTransaction(trans);
- // Set the initial attributes provided by the client
- for (unsigned i = 0; i < mModifiableAttributes.size(); ++i)
- {
- newCharacter->mAttributes.insert(
- std::make_pair(mModifiableAttributes.at(i), attributes[i]));
- }
-
- newCharacter->mAttributes.insert(mDefaultAttributes.begin(),
- mDefaultAttributes.end());
- newCharacter->setAccount(acc);
- newCharacter->setCharacterSlot(slot);
- newCharacter->setGender(gender);
- newCharacter->setHairStyle(hairStyle);
- newCharacter->setHairColor(hairColor);
- newCharacter->setMapId(Configuration::getValue("char_startMap", 1));
- Point startingPos(Configuration::getValue("char_startX", 1024),
- Configuration::getValue("char_startY", 1024));
- newCharacter->setPosition(startingPos);
- acc->addCharacter(newCharacter);
-
- LOG_INFO("Character " << name << " was created for "
- << acc->getName() << "'s account.");
-
- storage->flush(acc); // flush changes
-
- // log transaction
- Transaction trans;
- trans.mCharacterId = newCharacter->getDatabaseID();
- trans.mAction = TRANS_CHAR_CREATE;
- trans.mMessage = acc->getName() + " created character ";
- trans.mMessage.append("called " + name);
- storage->addTransaction(trans);
-
- reply.writeInt8(ERRMSG_OK);
- client.send(reply);
+ reply.writeInt8(ERRMSG_OK);
+ client.send(reply);
- // Send new characters infos back to client
- sendCharacterData(client, *chars[slot]);
- return;
- }
+ // Send new characters infos back to client
+ sendCharacterData(client, *chars[slot]);
}
client.send(reply);
diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h
index 1fc85ba6..782dc8b2 100644
--- a/src/common/manaserv_protocol.h
+++ b/src/common/manaserv_protocol.h
@@ -29,7 +29,7 @@
namespace ManaServ {
enum {
- PROTOCOL_VERSION = 1,
+ PROTOCOL_VERSION = 2,
SUPPORTED_DB_VERSION = 21
};
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index b139f121..0f4d8837 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -47,10 +47,10 @@
#include <limits.h>
// Experience curve related values
-const float Character::EXPCURVE_EXPONENT = 3.0f;
-const float Character::EXPCURVE_FACTOR = 10.0f;
-const float Character::LEVEL_SKILL_PRECEDENCE_FACTOR = 0.75f;
-const float Character::EXP_LEVEL_FLEXIBILITY = 1.0f;
+const float Character::EXPCURVE_EXPONENT = 2.5f;
+const float Character::EXPCURVE_FACTOR = 20.0f;
+const float Character::LEVEL_SKILL_PRECEDENCE_FACTOR = 0.85f;
+const float Character::EXP_LEVEL_FLEXIBILITY = 3.0f;
Script::Ref Character::mDeathCallback;
Script::Ref Character::mDeathAcceptedCallback;
diff --git a/src/game-server/character.h b/src/game-server/character.h
index 9c9a5459..830504c7 100644
--- a/src/game-server/character.h
+++ b/src/game-server/character.h
@@ -437,6 +437,7 @@ class Character : public Being
virtual BlockType getBlockType() const
{ return BLOCKTYPE_CHARACTER; }
+
private:
bool specialUseCheck(SpecialMap::iterator it);
diff --git a/src/game-server/inventory.cpp b/src/game-server/inventory.cpp
index 1fe09001..d523c7b8 100644
--- a/src/game-server/inventory.cpp
+++ b/src/game-server/inventory.cpp
@@ -216,7 +216,14 @@ unsigned Inventory::insert(unsigned itemId, unsigned amount)
break;
}
- item->useTrigger(mCharacter, ITT_IN_INVY);
+ if (item)
+ {
+ // EVIL HACK!! This allows to prevent sending the item to client.
+ // We need this hack for money items in lpc!
+ // REVERT THIS AS SOON AS POSSIBLE
+ if (item->useTrigger(mCharacter, ITT_IN_INVY))
+ return amount;
+ }
// Send that first, before checking potential removals
if (invMsg.getLength() > 2)
diff --git a/src/game-server/monstermanager.cpp b/src/game-server/monstermanager.cpp
index bb29babe..0fb62da0 100644
--- a/src/game-server/monstermanager.cpp
+++ b/src/game-server/monstermanager.cpp
@@ -265,6 +265,13 @@ void MonsterManager::initialize()
double factor = XML::getFloatProperty(subnode, "factor", 1.0);
monster->setVulnerability(element, factor);
}
+ else if (xmlStrEqual(subnode->name, BAD_CAST "vulnerability"))
+ {
+ Element element = elementFromString(
+ XML::getProperty(subnode, "element", std::string()));
+ float factor = XML::getFloatProperty(subnode, "factor", 1.0);
+ monster->setVulnerability(element, factor);
+ }
}
monster->setDrops(drops);