71 static const Uint16 _messages[] = {
99 Log::info(
"Changing server to %s:%d", address.c_str(), port);
121 if (playerInfoId > -1)
150 Log::warn(
"Server denied increase of attribute %d (unknown attribute) ", attrNum);
157 Log::warn(
"Server denied increase of attribute %d (no points left) ", attrNum);
165 Log::warn(
"Server denied increase of attribute %d (reason unknown) ", attrNum);
187 Log::warn(
"Server denied reduction of attribute %d (unknown attribute) ", attrNum);
194 Log::warn(
"Server denied reduction of attribute %d (no points left) ", attrNum);
204 Log::warn(
"Server denied reduction of attribute %d (reason unknown) ", attrNum);
260 const unsigned short x = msg.
readInt16();
261 const unsigned short y = msg.
readInt16();
266 Log::info(
"Changing map to %s (%d, %d)", mapName.c_str(), x, y);
272 float scrollOffsetX = 0.0f;
273 float scrollOffsetY = 0.0f;
280 scrollOffsetX = x - (int) playerPos.
x;
281 scrollOffsetY = y - (int) playerPos.
y;
288 Log::info(
"Adjust scrolling by %d,%d", (
int) scrollOffsetX,
289 (
int) scrollOffsetY);
298 Log::info(
"PlayerHandler::attack: 'Strike' ability not found.");
302 switch (ability->targetMode) {
307 Log::info(
"PlayerHandler::attack: Unsupported target mode 'point' for 'Strike' ability.");
410 return Vector(6.0f, 6.0f, 0.0f);
423 Log::info(
"Manaserv::PlayerHandler: Speed wasn't given back"
424 " because Map not initialized.");
425 return speedInPixels;
431 return speedInPixels;
int getPixelX() const
Returns the pixels X coordinate of the actor.
int getPixelY() const
Returns the pixel Y coordinate of the actor.
const Vector & getPosition() const
Returns the pixel position of this actor.
void setPosition(const Vector &pos) final
Sets the pixel position of this actor.
void setMap(Map *map) final
uint8_t getDirection() const
Returns the current direction.
Action
Action the being is currently performing WARNING: Has to be in sync with the same enum in the Being c...
static void setState(State state)
void trigger(Channel channel) const
Sends this event to all classes listening to the given channel.
An item lying on the floor.
The main class responsible for running the game.
const std::string & getCurrentMapName()
Map * getCurrentMap()
Returns the currently active map.
static Game * instance()
Provides access to the game instance.
void changeMap(const std::string &mapName)
Changes the currently active map.
void setAction(Action action, int attackId=1) override
Sets the current action.
virtual void setDestination(int x, int y)
Sets a new destination for this being to walk to.
void send(const ManaServ::MessageOut &msg)
Sends a message.
void disconnect()
Disconnects from the given server.
Used for parsing an incoming message from manaserv.
uint16_t readInt16()
Reads an unsigned 16-bit integer from the message.
unsigned int getUnreadLength() const
Returns the length of unread data.
std::string readString(int length=-1)
Reads a string.
uint16_t getId() const
Returns the message ID.
uint32_t readInt32()
Reads an unsigned 32-bit integer from the message.
uint8_t readInt8()
Reads an unsigned 8-bit integer from the message.
Used for building an outgoing message to manaserv.
void writeInt16(uint16_t value)
Writes an unsigned 16-bit integer to the message.
void writeInt8(uint8_t value)
Writes an unsigned 8-bit integer to the message.
void decreaseAttribute(int attr) override
void emote(int emoteId) override
void attack(int id) override
void setDestination(int x, int y, int direction=-1) override
Vector getPixelsPerSecondMoveSpeed(const Vector &speed, Map *map=nullptr) override
Convert the original server-dependant speed for internal use.
void handleMessage(MessageIn &msg) override
void handleMapChangeMessage(MessageIn &msg)
void increaseAttribute(int attr) override
void ignoreAll(bool ignore) override
bool canCorrectAttributes() override
bool canUseMagic() override
void ignorePlayer(const std::string &player, bool ignore) override
void setDirection(char direction) override
void changeAction(Being::Action action) override
void pickUp(FloorItem *floorItem) override
Vector getDefaultMoveSpeed() const override
Get the original default movement speed.
int getJobLocation() override
void increaseSkill(int skillId) override
int getTileHeight() const
Returns the tile height used by this map.
int getTileWidth() const
Returns the tile width of this map.
virtual void useInDirection(int id, int direction)=0
virtual void useOn(int id, int beingId)=0
const uint16_t * handledMessages
void scrollBy(float x, float y)
Changes viewpoint by relative pixel coordinates.
Viewport * viewport
Viewport on the map.
LocalPlayer * local_player
Net::AbilityHandler * abilityHandler
const int MAP_TELEPORT_SCROLL_DISTANCE
Max.
Net::AbilityHandler * abilityHandler
Net::PlayerHandler * playerHandler
AbilityInfo * find(std::string_view name)
Finds an ability by name.
int getPlayerInfoIdFromAttrId(int attrId)
Give back the corresponding playerinfo Id from the attribute id defined in the xml file.
void warn(const char *log_text,...) LOG_PRINTF_ATTR
void info(const char *log_text,...) LOG_PRINTF_ATTR
@ ATTRIBMOD_NO_POINTS_LEFT
@ ATTRIBMOD_INVALID_ATTRIBUTE
Connection * gameServerConnection
@ GPMSG_PLAYER_SERVER_CHANGE
@ GPMSG_PLAYER_MAP_CHANGE
@ GPMSG_ATTRIBUTE_POINTS_STATUS
@ GPMSG_RAISE_ATTRIBUTE_RESPONSE
@ GPMSG_LOWER_ATTRIBUTE_RESPONSE
@ GPMSG_PLAYER_ATTRIBUTE_CHANGE
PlayerHandler * getPlayerHandler()
int getStatBase(int id)
Returns the base value of the given stat.
void setAbilityStatus(int id, int current, int max, int recharge)
Changes the status of the given ability.
void setStatBase(int id, int value, bool notify)
Changes the base value of the given stat.
void setAttribute(int id, int value, bool notify)
Changes the value of the given attribute.
void clearAbilityStatus(int id)
Removes the status for the given ability.
int getAttribute(int id)
Returns the value of the given attribute.
void setStatMod(int id, int value, bool notify)
Changes the modifier for the given stat.
void action(const gcn::ActionEvent &event) override