summaryrefslogblamecommitdiff
path: root/src/net/ea/beinghandler.cpp
blob: c6606fda8aeed79160568ace8c0c93210b52f786 (plain) (tree)
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719



















































                                                                         
                  



























                                                                  


                                             






























                                                                               
                             























































































                                                                   
                                    
                        
                                          



                                      


                                                                   
                                  











































































































































































































































































































































































































































































































                                                                            
                                                                          




























































































                                                                  
/*
 *  The ManaPlus Client
 *  Copyright (C) 2004-2009  The Mana World Development Team
 *  Copyright (C) 2009-2010  The Mana Developers
 *  Copyright (C) 2011  The ManaPlus Developers
 *
 *  This file is part of The ManaPlus Client.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "net/ea/beinghandler.h"

#include "net/ea/eaprotocol.h"

#include "actorspritemanager.h"
#include "being.h"
#include "client.h"
#include "effectmanager.h"
#include "guild.h"
#include "keyboardconfig.h"
#include "localplayer.h"
#include "log.h"
#include "party.h"
#include "playerrelations.h"
#include "configuration.h"

#include "gui/botcheckerwindow.h"
#include "gui/outfitwindow.h"
#include "gui/socialwindow.h"
#include "gui/killstats.h"

#include "utils/gettext.h"
#include "utils/stringutils.h"

#include "net/playerhandler.h"
#include "net/net.h"

#include "resources/colordb.h"

#include <iostream>

#include "debug.h"

namespace Ea
{
const int EMOTION_TIME = 500;    /**< Duration of emotion icon */

BeingHandler::BeingHandler(bool enableSync):
    mSync(enableSync),
    mSpawnId(0)
{
}

Being *BeingHandler::createBeing(int id, short job)
{
    if (!actorSpriteManager)
        return 0;

    ActorSprite::Type type = ActorSprite::UNKNOWN;
    if (job <= 25 || (job >= 4001 && job <= 4049))
        type = ActorSprite::PLAYER;
    else if (job >= 46 && job <= 1000)
        type = ActorSprite::NPC;
    else if (job > 1000 && job <= 2000)
        type = ActorSprite::MONSTER;
    else if (job == 45)
        type = ActorSprite::PORTAL;

    Being *being = actorSpriteManager->createBeing(id, type, job);

    if (type == ActorSprite::PLAYER || type == ActorSprite::NPC)
    {
        being->updateFromCache();
        requestNameById(id);
        if (player_node)
            player_node->checkNewName(being);
    }
    if (type == Being::PLAYER)
    {
        if (botCheckerWindow)
            botCheckerWindow->updateList();
        if (socialWindow)
            socialWindow->updateActiveList();
    }
    return being;
}

void BeingHandler::setSprite(Being *being, unsigned int slot, int id,
                             std::string color, unsigned char colorId,
                             bool isWeapon, bool isTempSprite)
{
    if (!being)
        return;
    being->setSprite(slot, id, color, colorId, isWeapon, isTempSprite);
}

void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
{
    if (!actorSpriteManager)
        return;

    int id;
    short job, speed, gender;
    Uint16 headTop, headMid, headBottom;
    Uint16 shoes, gloves;
    Uint16 weapon, shield;
    Uint16 stunMode;
    Uint32 statusEffects;
    Being *dstBeing;
    int hairStyle, hairColor;
    int spawnId;

    // Information about a being in range
    id = msg.readInt32();
    if (id == mSpawnId)
        spawnId = mSpawnId;
    else
        spawnId = 0;
    mSpawnId = 0;
    speed = msg.readInt16();
    stunMode = msg.readInt16();  // opt1
    statusEffects = msg.readInt16();  // opt2
    statusEffects |= (static_cast<Uint32>(
        msg.readInt16())) << 16;  // option
    job = msg.readInt16();  // class

    dstBeing = actorSpriteManager->findBeing(id);

    if (dstBeing && dstBeing->getType() == Being::MONSTER
        && !dstBeing->isAlive())
    {
        actorSpriteManager->destroy(dstBeing);
        actorSpriteManager->erase(dstBeing);
        dstBeing = 0;
    }

    if (!dstBeing)
    {
        // Being with id >= 110000000 and job 0 are better
        // known as ghosts, so don't create those.
        if (job == 0 && id >= 110000000)
            return;

        if (actorSpriteManager->isBlocked(id) == true)
            return;

        dstBeing = createBeing(id, job);

        if (!dstBeing)
            return;

        if (job == 1022 && killStats)
            killStats->jackoAlive(dstBeing->getId());
    }
    else
    {
        // undeleting marked for deletion being
        if (dstBeing->getType() == Being::NPC)
            actorSpriteManager->undelete(dstBeing);
    }

    if (dstBeing->getType() == Being::PLAYER)
        dstBeing->setMoveTime();

    if (spawnId)
    {
        dstBeing->setAction(Being::SPAWN);
    }
    else if (visible)
    {
        dstBeing->clearPath();
        dstBeing->setActionTime(tick_time);
        dstBeing->setAction(Being::STAND);
    }

    // Prevent division by 0 when calculating frame
    if (speed == 0)
        speed = 150;

    dstBeing->setWalkSpeed(Vector(speed, speed, 0));
    dstBeing->setSubtype(job);
    if (dstBeing->getType() == ActorSprite::MONSTER && player_node)
        player_node->checkNewName(dstBeing);

    hairStyle = msg.readInt16();
    weapon = msg.readInt16();
    headBottom = msg.readInt16();

    if (!visible)
        msg.readInt32(); // server tick

    shield = msg.readInt16();
    headTop = msg.readInt16();
    headMid = msg.readInt16();
    hairColor = msg.readInt16();
    shoes = msg.readInt16();  // clothes color - "abused" as shoes

    if (dstBeing->getType() == ActorSprite::MONSTER)
    {
        int hp = msg.readInt32();
        int maxHP = msg.readInt32();
        if (hp && maxHP)
        {
            int oldHP = dstBeing->getHP();
            if (!oldHP || oldHP > hp)
                dstBeing->setHP(hp);
            dstBeing->setMaxHP(maxHP);
        }
        gloves = 0;
    }
    else
    {
        gloves = msg.readInt16();  // head dir - "abused" as gloves
        msg.readInt32();  // guild
        msg.readInt16();  // guild emblem
    }
//            logger->log("being guild: " + toString(guild));
/*
    if (guild == 0)
        dstBeing->clearGuilds();
    else
        dstBeing->setGuild(Guild::getGuild(static_cast<short>(guild)));
*/

    msg.readInt16();  // manner
    dstBeing->setStatusEffectBlock(32, msg.readInt16());  // opt3
    msg.readInt8();   // karma
    gender = msg.readInt8();

    if (dstBeing->getType() == ActorSprite::PLAYER)
    {
        dstBeing->setGender((gender == 0)
                            ? GENDER_FEMALE : GENDER_MALE);
        // Set these after the gender, as the sprites may be gender-specific
        setSprite(dstBeing, EA_SPRITE_HAIR, hairStyle * -1,
                  ColorDB::getHairColor(hairColor));
        setSprite(dstBeing, EA_SPRITE_BOTTOMCLOTHES, headBottom);
        setSprite(dstBeing, EA_SPRITE_TOPCLOTHES, headMid);
        setSprite(dstBeing, EA_SPRITE_HAT, headTop);
        setSprite(dstBeing, EA_SPRITE_SHOE, shoes);
        setSprite(dstBeing, EA_SPRITE_GLOVES, gloves);
        setSprite(dstBeing, EA_SPRITE_WEAPON, weapon, "", true);
        if (!config.getBoolValue("hideShield"))
            setSprite(dstBeing, EA_SPRITE_SHIELD, shield);
    }
    else if (dstBeing->getType() == ActorSprite::NPC)
    {
        switch (gender)
        {
            case 2:
                dstBeing->setGender(GENDER_FEMALE);
                break;
            case 3:
                dstBeing->setGender(GENDER_MALE);
                break;
            default:
                dstBeing->setGender(GENDER_UNSPECIFIED);
                break;
        }
    }


    if (!visible)
    {
        Uint16 srcX, srcY, dstX, dstY;
        msg.readCoordinatePair(srcX, srcY, dstX, dstY);
        dstBeing->setAction(Being::STAND);
        dstBeing->setTileCoords(srcX, srcY);
        dstBeing->setDestination(dstX, dstY);
//                if (player_node && player_node->getTarget() == dstBeing)
//                    player_node->targetMoved();
    }
    else
    {
        Uint8 dir;
        Uint16 x, y;
        msg.readCoordinates(x, y, dir);
        dstBeing->setTileCoords(x, y);


        if (job == 45 && socialWindow && outfitWindow)
        {
            int num = socialWindow->getPortalIndex(x, y);
            if (num >= 0)
            {
                dstBeing->setName(keyboard.getKeyShortString(
                    outfitWindow->keyName(num)));
            }
            else
            {
                dstBeing->setName("");
            }
        }

        dstBeing->setDirection(dir);
    }

    msg.readInt8();   // unknown
    msg.readInt8();   // unknown
//            msg.readInt8();   // unknown / sit
    msg.readInt16();

    dstBeing->setStunMode(stunMode);
    dstBeing->setStatusEffectBlock(0, static_cast<Uint16>(
        (statusEffects >> 16) & 0xffff));
    dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff);

}

void BeingHandler::processBeingMove2(Net::MessageIn &msg)
{
    if (!actorSpriteManager)
        return;

    /*
      * A simplified movement packet, used by the
      * later versions of eAthena for both mobs and
      * players
      */
    Being *dstBeing = actorSpriteManager->findBeing(msg.readInt32());

    /*
      * This packet doesn't have enough info to actually
      * create a new being, so if the being isn't found,
      * we'll just pretend the packet didn't happen
      */

    if (!dstBeing)
        return;

    Uint16 srcX, srcY, dstX, dstY;
    msg.readCoordinatePair(srcX, srcY, dstX, dstY);
    msg.readInt32();  // Server tick

    dstBeing->setAction(Being::STAND);
    dstBeing->setTileCoords(srcX, srcY);
    dstBeing->setDestination(dstX, dstY);
    if (dstBeing->getType() == Being::PLAYER)
        dstBeing->setMoveTime();
}

void BeingHandler::processBeingSpawn(Net::MessageIn &msg)
{
    // skipping this packet
    mSpawnId = msg.readInt32();    // id
    msg.readInt16();    // speed
    msg.readInt16();  // opt1
    msg.readInt16();  // opt2
    msg.readInt16();  // option
    msg.readInt16();    // disguise
}

void BeingHandler::processBeingRemove(Net::MessageIn &msg)
{
    if (!actorSpriteManager || !player_node)
        return;

    // A being should be removed or has died

    int id = msg.readInt32();
    Being *dstBeing = actorSpriteManager->findBeing(id);
    if (!dstBeing)
        return;

    player_node->followMoveTo(dstBeing, player_node->getNextDestX(),
                              player_node->getNextDestY());

    // If this is player's current target, clear it.
    if (dstBeing == player_node->getTarget())
        player_node->stopAttack();

    if (msg.readInt8() == 1)
    {
        dstBeing->setAction(Being::DEAD);
        if (dstBeing->getName() == "Jack O" && killStats)
            killStats->jackoDead(id);
    }
    else
    {
        if (dstBeing->getType() == Being::PLAYER)
        {
            if (botCheckerWindow)
                botCheckerWindow->updateList();
            if (socialWindow)
                socialWindow->updateActiveList();
        }
        actorSpriteManager->destroy(dstBeing);
    }
}

void BeingHandler::processBeingResurrect(Net::MessageIn &msg)
{
    if (!actorSpriteManager || !player_node)
        return;

    // A being changed mortality status

    int id = msg.readInt32();
    Being *dstBeing = actorSpriteManager->findBeing(id);
    if (!dstBeing)
        return;

    // If this is player's current target, clear it.
    if (dstBeing == player_node->getTarget())
        player_node->stopAttack();

    if (msg.readInt8() == 1)
        dstBeing->setAction(Being::STAND);
}


void BeingHandler::processSkillDamage(Net::MessageIn &msg)
{
    if (!actorSpriteManager)
        return;

    Being *srcBeing;
    Being *dstBeing;
    int param1;

    msg.readInt16(); // Skill Id
    srcBeing = actorSpriteManager->findBeing(msg.readInt32());
    dstBeing = actorSpriteManager->findBeing(msg.readInt32());
    msg.readInt32(); // Server tick
    msg.readInt32(); // src speed
    msg.readInt32(); // dst speed
    param1 = msg.readInt32(); // Damage
    msg.readInt16(); // Skill level
    msg.readInt16(); // Div
    msg.readInt8(); // Skill hit/type (?)
    if (dstBeing)
    {
        // Perhaps a new skill attack type should be created and used?
//                if (dstSpeed)
//                    dstBeing->setAttackDelay(dstSpeed);
        dstBeing->takeDamage(srcBeing, param1, Being::HIT);
    }
    if (srcBeing)
    {
//                if (srcSpeed)
//                    srcBeing->setAttackDelay(srcSpeed);
        srcBeing->handleAttack(dstBeing, param1, Being::HIT);
    }
}

void BeingHandler::processBeingAction(Net::MessageIn &msg)
{
    if (!actorSpriteManager)
        return;

    Being *srcBeing;
    Being *dstBeing;
    int param1;
    int type;

    srcBeing = actorSpriteManager->findBeing(msg.readInt32());
    dstBeing = actorSpriteManager->findBeing(msg.readInt32());

    msg.readInt32();   // server tick
    int srcSpeed = msg.readInt32();   // src speed
    msg.readInt32();   // dst speed
    param1 = msg.readInt16();
    msg.readInt16();  // param 2
    type = msg.readInt8();
    msg.readInt16();  // param 3

    switch (type)
    {
        case Being::HIT: // Damage
        case Being::CRITICAL: // Critical Damage
        case Being::MULTI: // Critical Damage
        case Being::REFLECT: // Reflected Damage
        case Being::FLEE: // Lucky Dodge
            if (dstBeing)
            {
//                        if (dstSpeed)
//                            dstBeing->setAttackDelay(dstSpeed);
                dstBeing->takeDamage(srcBeing, param1,
                    static_cast<Being::AttackType>(type));
            }
            if (srcBeing)
            {
                if (srcSpeed && srcBeing->getType() == Being::PLAYER)
                    srcBeing->setAttackDelay(srcSpeed);
                srcBeing->handleAttack(dstBeing, param1,
                    static_cast<Being::AttackType>(type));
                if (srcBeing->getType() == Being::PLAYER)
                    srcBeing->setAttackTime();
            }
            break;

        case 0x02: // Sit
            if (srcBeing)
            {
                srcBeing->setAction(Being::SIT);
                if (srcBeing->getType() == Being::PLAYER)
                {
                    srcBeing->setMoveTime();
                    if (player_node)
                    {
                        player_node->imitateAction(
                            srcBeing, Being::SIT);
                    }
                }
            }
            break;

        case 0x03: // Stand up
            if (srcBeing)
            {
                srcBeing->setAction(Being::STAND);
                if (srcBeing->getType() == Being::PLAYER)
                {
                    srcBeing->setMoveTime();
                    if (player_node)
                    {
                        player_node->imitateAction(
                            srcBeing, Being::STAND);
                    }
                }
            }
            break;
        default:
            break;
/*
            logger->log("QQQ1 SMSG_BEING_ACTION:");
            if (srcBeing)
                logger->log("srcBeing:" + toString(srcBeing->getId()));
            if (dstBeing)
                logger->log("dstBeing:" + toString(dstBeing->getId()));
            logger->log("type: " + toString(type));
*/
    }
}

void BeingHandler::processBeingSelfEffect(Net::MessageIn &msg)
{
    if (!effectManager || !actorSpriteManager)
        return;

    int id;

    id = static_cast<Uint32>(msg.readInt32());
    Being* being = actorSpriteManager->findBeing(id);
    if (!being)
        return;

    int effectType = msg.readInt32();

    effectManager->trigger(effectType, being);

    //+++ need dehard code effectType == 3
    if (being && effectType == 3
        && being->getType() == Being::PLAYER
        && socialWindow)
    {   //reset received damage
        socialWindow->resetDamage(being->getName());
    }
}

void BeingHandler::processBeingEmotion(Net::MessageIn &msg)
{
    if (!player_node || !actorSpriteManager)
        return;

    Being *dstBeing;

    if (!(dstBeing = actorSpriteManager->findBeing(msg.readInt32())))
        return;

    if (player_relations.hasPermission(dstBeing,
        PlayerRelation::EMOTE))
    {
        unsigned char emote = msg.readInt8();
        if (emote)
        {
            dstBeing->setEmote(emote, EMOTION_TIME);
            player_node->imitateEmote(dstBeing, emote);
        }
    }
    if (dstBeing->getType() == Being::PLAYER)
        dstBeing->setOtherTime();
}

void BeingHandler::processNameResponse(Net::MessageIn &msg)
{
    if (!player_node || !actorSpriteManager)
        return;

    Being *dstBeing;

    int beingId = msg.readInt32();
    if ((dstBeing = actorSpriteManager->findBeing(beingId)))
    {
        if (beingId == player_node->getId())
        {
            player_node->pingResponse();
        }
        else
        {
            dstBeing->setName(msg.readString(24));
            dstBeing->updateGuild();
            dstBeing->addToCache();

            if (dstBeing->getType() == Being::PLAYER)
                dstBeing->updateColors();

            if (player_node)
            {
                Party *party = player_node->getParty();
                if (party && party->isMember(dstBeing->getId()))
                {
                    PartyMember *member = party->getMember(
                        dstBeing->getId());

                    if (member)
                        member->setName(dstBeing->getName());
                }
                player_node->checkNewName(dstBeing);
            }
        }
    }
}

void BeingHandler::processIpResponse(Net::MessageIn &msg)
{
    if (!actorSpriteManager)
        return;

    Being *dstBeing;

    if ((dstBeing = actorSpriteManager->findBeing(
        msg.readInt32())))
    {
        dstBeing->setIp(ipToString(msg.readInt32()));
    }
}

void BeingHandler::processPlayerGuilPartyInfo(Net::MessageIn &msg)
{
    if (!actorSpriteManager)
        return;

    Being *dstBeing;

    if ((dstBeing = actorSpriteManager->findBeing(msg.readInt32())))
    {
        dstBeing->setPartyName(msg.readString(24));
        dstBeing->setGuildName(msg.readString(24));
        dstBeing->setGuildPos(msg.readString(24));
        dstBeing->addToCache();
        msg.readString(24); // Discard this
    }
}

void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg)
{
    if (!actorSpriteManager)
        return;

    Being *dstBeing;

    if (!(dstBeing = actorSpriteManager->findBeing(msg.readInt32())))
        return;

    msg.readInt16(); // unused

    unsigned char dir = msg.readInt8();
    dstBeing->setDirection(dir);
    if (player_node)
        player_node->imitateDirection(dstBeing, dir);
}

void BeingHandler::processPlayerStop(Net::MessageIn &msg)
{
    if (!actorSpriteManager || !player_node)
        return;

    /*
      *  Instruction from server to stop walking at x, y.
      *
      *  Some people like having this enabled.  Others absolutely
      *  despise it.  So I'm setting to so that it only affects the
      *  local player if the person has set a key "EnableSync" to "1"
      *  in their config.xml file.
      *
      *  This packet will be honored for all other beings, regardless
      *  of the config setting.
      */

    int id = msg.readInt32();

    if (mSync || id != player_node->getId())
    {
        Being *dstBeing = actorSpriteManager->findBeing(id);
        if (dstBeing)
        {
            Uint16 x, y;
            x = msg.readInt16();
            y = msg.readInt16();
            dstBeing->setTileCoords(x, y);
            if (dstBeing->getCurrentAction() == Being::MOVE)
                dstBeing->setAction(Being::STAND);
        }
    }
}

void BeingHandler::processPlayerMoveToAttack(Net::MessageIn &msg A_UNUSED)
{
    /*
      * This is an *advisory* message, telling the client that
      * it needs to move the character before attacking
      * a target (out of range, obstruction in line of fire).
      * We can safely ignore this...
      */
    if (player_node)
        player_node->fixAttackTarget();
}

void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg)
{
    if (!actorSpriteManager)
        return;

    // Change in players' flags

    int id = msg.readInt32();
    Being *dstBeing = actorSpriteManager->findBeing(id);
    if (!dstBeing)
        return;

    Uint16 stunMode = msg.readInt16();
    Uint32 statusEffects = msg.readInt16();
    statusEffects |= (static_cast<Uint32>(msg.readInt16())) << 16;
    msg.readInt8(); // Unused?

    dstBeing->setStunMode(stunMode);
    dstBeing->setStatusEffectBlock(0, static_cast<Uint16>(
        (statusEffects >> 16) & 0xffff));
    dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff);
}

void BeingHandler::processBeingStatusChange(Net::MessageIn &msg)
{
    if (!actorSpriteManager)
        return;

    // Status change
    Uint16 status = msg.readInt16();
    int id = msg.readInt32();
    int flag = msg.readInt8(); // 0: stop, 1: start

    Being *dstBeing = actorSpriteManager->findBeing(id);
    if (dstBeing)
        dstBeing->setStatusEffect(status, flag);
}

void BeingHandler::processSkilCasting(Net::MessageIn &msg)
{
    msg.readInt32();    // src id
    msg.readInt32();    // dst id
    msg.readInt16();    // dst x
    msg.readInt16();    // dst y
    msg.readInt16();    // skill num
    msg.readInt32();    // skill get pl
    msg.readInt32();    // cast time
}

void BeingHandler::processSkillNoDamage(Net::MessageIn &msg)
{
    msg.readInt16();    // skill id
    msg.readInt16();    // heal
    msg.readInt32();    // dst id
    msg.readInt32();    // src id
    msg.readInt8();     // fail
}

void BeingHandler::processPvpMapMode(Net::MessageIn &msg)
{
    Game *game = Game::instance();
    if (!game)
        return;

    Map *map = game->getCurrentMap();
    if (map)
        map->setPvpMode(msg.readInt16());
}

void BeingHandler::processPvpSet(Net::MessageIn &msg)
{
    int id = msg.readInt32();    // id
    int rank = msg.readInt32();  // rank
    msg.readInt32();             // num
    if (actorSpriteManager)
    {
        Being *dstBeing = actorSpriteManager->findBeing(id);
        if (dstBeing)
            dstBeing->setPvpRank(rank);
    }
}

} // namespace Ea