45#define POSITION_DIFF_TOLERANCE 48
51 static const Uint16 _messages[] = {
110 const int hairStyle = msg.
readInt8();
111 const int hairColor = msg.
readInt8();
115 std::map<unsigned, int> equippedSlots;
118 int equippedSlotCount = msg.
readInt8();
119 while (equippedSlotCount-- > 0) {
122 equippedSlots[slot] = itemId;
126 unsigned endSlot = equippedSlots.empty() ? 0 : equippedSlots.rbegin()->first + 1;
130 for (
unsigned slot = 0; slot < endSlot; ++slot)
132 auto it = equippedSlots.find(slot);
133 if (it == equippedSlots.end())
176 handleLooks(being, msg);
233 int sx = 0, sy = 0, dx = 0, dy = 0, speed = 0;
259 float speedTilesSeconds = (float) speed / 10;
289 const int abilityId = msg.
readInt8();
305 const int abilityId = msg.
readInt8();
309 being->
lookAt(target->getPosition());
321 const int abilityId = msg.
readInt8();
322 const int direction = msg.
readInt8();
352 static char const *
const deadMsg[] =
355 _(
"We regret to inform you that your character was killed in "
357 _(
"You are not that alive anymore."),
358 _(
"The cold hands of the grim reaper are grabbing for your soul."),
360 _(
"No, kids. Your character did not really die. It... err... "
361 "went to a better place."),
362 _(
"Your plan of breaking your enemies weapon by bashing it with "
363 "your throat failed."),
364 _(
"I guess this did not run too well."),
365 _(
"Do you want your possessions identified?"),
366 _(
"Sadly, no trace of you was ever found..."),
368 _(
"Looks like you got your head handed to you."),
369 _(
"You screwed up again, dump your body down the tubes and get "
373 std::string message(deadMsg[rand()%13]);
374 message.append(std::string(
" ") +
_(
"Press OK to respawn."));
375 auto *dlg =
new OkDialog(
_(
"You Died"), message,
false);
376 dlg->addActionListener(&(ManaServ::respawnListener));
386 handleLooks(being, msg);
ActorSpriteManager * actorSpriteManager
Being * createBeing(int id, ActorSprite::Type type, int subtype)
Create a Being and add it to the list of ActorSprites.
void destroyActor(ActorSprite *actor)
Immediately destroys the given actor.
Being * findBeing(int id) const
Returns a specific Being, by id;.
const Vector & getPosition() const
Returns the pixel position of this actor.
void setPosition(const Vector &pos) final
Sets the pixel position of this actor.
unsigned getSpriteCount() const
void setSprite(unsigned slot, int id, const std::string &color=std::string(), bool isWeapon=false)
Sets visible equipments for this being.
void setDestination(int ex, int ey)
Creates a path for the being from current position to ex and ey.
void setMoveSpeed(const Vector &speed)
Sets the move speed.
void setDirection(uint8_t direction)
Sets the current direction.
Type getType() const final
Returns the type of the ActorSprite.
void lookAt(const Vector &destVec)
Make the being look at a given pixel position.
void setName(const std::string &name)
Sets the name for the being.
Action
Action the being is currently performing WARNING: Has to be in sync with the same enum in the Being c...
virtual void setAction(Action action, int attackId=1)
Sets the current action.
const std::string & getName() const
Returns the name of the being.
void setGender(Gender gender)
Sets the gender of this being.
void takeDamage(Being *attacker, int damage, AttackType type, int attackId=1)
Puts a damage bubble above this being.
bool trigger(int id, Being *being, int rotation=0)
Triggers a effect with the id, at the specified being, and with the given rotation in degree: 0° = Do...
const std::string & getHairColor(int id) const
void handleBeingAbilityBeingMessage(MessageIn &msg)
void handleBeingEnterMessage(MessageIn &msg)
void handleBeingsDamageMessage(MessageIn &msg)
void handleBeingAbilityPointMessage(MessageIn &msg)
void handleBeingActionChangeMessage(MessageIn &msg)
void handleBeingEmoteMessage(MessageIn &msg)
void handleBeingLooksChangeMessage(MessageIn &msg)
void handleMessage(MessageIn &msg) override
void handleBeingLeaveMessage(MessageIn &msg)
void handleBeingsMoveMessage(MessageIn &msg)
void handleBeingAbilityDirectionMessage(MessageIn &msg)
void handleBeingDirChangeMessage(MessageIn &msg)
bool isWeaponSlot(unsigned int slotTypeId) const override
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.
uint8_t readInt8()
Reads an unsigned 8-bit integer from the message.
const uint16_t * handledMessages
bool hasPermission(Being *being, unsigned int flags)
Tests whether the player in question is being ignored for any of the actions in the specified flags.
float length() const
Returns the length of this vector.
HairDB hairDB
Hair styles and colors info database.
EffectManager * effectManager
LocalPlayer * local_player
#define POSITION_DIFF_TOLERANCE
AbilityInfo * get(int id)
Gets the ability info for ID.
const Emote & get(int id)
@ FIXED_SPRITE_LAYER_SIZE
BeingDirection
Beings and actors directions WARNING: Has to be in sync with the same enum in the Being class of the ...
Gender getGender(int gender)
Helper function for getting gender by int.
@ GPMSG_BEING_LOOKS_CHANGE
@ GPMSG_BEING_ACTION_CHANGE
@ GPMSG_BEING_ABILITY_DIRECTION
@ GPMSG_BEING_ABILITY_BEING
@ GPMSG_BEING_ABILITY_POINT
InventoryHandler * getInventoryHandler()
PlayerRelationsManager player_relations