~ubuntu-branches/ubuntu/vivid/manaplus/vivid-proposed

« back to all changes in this revision

Viewing changes to src/net/eathena/playerhandler.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2014-10-12 12:23:57 UTC
  • mfrom: (1.1.36)
  • Revision ID: package-import@ubuntu.com-20141012122357-7836sgv1j1v02cs2
Tags: 1.4.10.11-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#include "gui/windows/statuswindow.h"
29
29
 
30
 
#include "net/eathena/attrs.h"
31
30
#include "net/eathena/messageout.h"
32
31
#include "net/eathena/protocol.h"
33
32
#include "net/eathena/inventoryhandler.h"
59
58
        SMSG_PLAYER_GET_EXP,
60
59
        SMSG_PVP_INFO,
61
60
        SMSG_PLAYER_HEAL,
 
61
        SMSG_PLAYER_SKILL_MESSAGE,
62
62
        0
63
63
    };
64
64
    handledMessages = _messages;
126
126
            processPlayerHeal(msg);
127
127
            break;
128
128
 
 
129
        case SMSG_PLAYER_SKILL_MESSAGE:
 
130
            processPlayerSkillMessage(msg);
 
131
            break;
 
132
 
129
133
        default:
130
134
            break;
131
135
    }
154
158
 
155
159
void PlayerHandler::increaseAttribute(const int attr) const
156
160
{
157
 
    if (attr >= STR && attr <= LUK)
 
161
    if (attr >= Attributes::STR && attr <= Attributes::LUK)
158
162
    {
159
163
        createOutPacket(CMSG_STAT_UPDATE_REQUEST);
160
164
        outMsg.writeInt16(static_cast<int16_t>(attr));
291
295
        msg.readInt16("char points"));
292
296
 
293
297
    unsigned int val = msg.readUInt8("str");
294
 
    PlayerInfo::setStatBase(STR, val);
 
298
    PlayerInfo::setStatBase(Attributes::STR, val);
295
299
    if (statusWindow)
296
 
        statusWindow->setPointsNeeded(STR, msg.readUInt8("str cost"));
 
300
    {
 
301
        statusWindow->setPointsNeeded(Attributes::STR,
 
302
            msg.readUInt8("str cost"));
 
303
    }
297
304
    else
 
305
    {
298
306
        msg.readUInt8("str need");
 
307
    }
299
308
 
300
309
    val = msg.readUInt8("agi");
301
 
    PlayerInfo::setStatBase(AGI, val);
 
310
    PlayerInfo::setStatBase(Attributes::AGI, val);
302
311
    if (statusWindow)
303
 
        statusWindow->setPointsNeeded(AGI, msg.readUInt8("agi cost"));
 
312
    {
 
313
        statusWindow->setPointsNeeded(Attributes::AGI,
 
314
            msg.readUInt8("agi cost"));
 
315
    }
304
316
    else
 
317
    {
305
318
        msg.readUInt8("agi cost");
 
319
    }
306
320
 
307
321
    val = msg.readUInt8("vit");
308
 
    PlayerInfo::setStatBase(VIT, val);
 
322
    PlayerInfo::setStatBase(Attributes::VIT, val);
309
323
    if (statusWindow)
310
 
        statusWindow->setPointsNeeded(VIT, msg.readUInt8("vit cost"));
 
324
    {
 
325
        statusWindow->setPointsNeeded(Attributes::VIT,
 
326
            msg.readUInt8("vit cost"));
 
327
    }
311
328
    else
 
329
    {
312
330
        msg.readUInt8("vit cost");
 
331
    }
313
332
 
314
333
    val = msg.readUInt8("int");
315
 
    PlayerInfo::setStatBase(INT, val);
 
334
    PlayerInfo::setStatBase(Attributes::INT, val);
316
335
    if (statusWindow)
317
 
        statusWindow->setPointsNeeded(INT, msg.readUInt8("int cost"));
 
336
    {
 
337
        statusWindow->setPointsNeeded(Attributes::INT,
 
338
            msg.readUInt8("int cost"));
 
339
    }
318
340
    else
 
341
    {
319
342
        msg.readUInt8("int cost");
 
343
    }
320
344
 
321
345
    val = msg.readUInt8("dex");
322
 
    PlayerInfo::setStatBase(DEX, val);
 
346
    PlayerInfo::setStatBase(Attributes::DEX, val);
323
347
    if (statusWindow)
324
 
        statusWindow->setPointsNeeded(DEX, msg.readUInt8("dex cost"));
 
348
    {
 
349
        statusWindow->setPointsNeeded(Attributes::DEX,
 
350
            msg.readUInt8("dex cost"));
 
351
    }
325
352
    else
 
353
    {
326
354
        msg.readUInt8("dex cost");
 
355
    }
327
356
 
328
357
    val = msg.readUInt8("luk");
329
 
    PlayerInfo::setStatBase(LUK, val);
 
358
    PlayerInfo::setStatBase(Attributes::LUK, val);
330
359
    if (statusWindow)
331
 
        statusWindow->setPointsNeeded(LUK, msg.readUInt8("luk cost"));
 
360
    {
 
361
        statusWindow->setPointsNeeded(Attributes::LUK,
 
362
            msg.readUInt8("luk cost"));
 
363
    }
332
364
    else
 
365
    {
333
366
        msg.readUInt8("luk cost");
 
367
    }
334
368
 
335
 
    PlayerInfo::setStatBase(ATK, msg.readInt16("left atk"), false);
336
 
    PlayerInfo::setStatMod(ATK, msg.readInt16("right atk"));
 
369
    PlayerInfo::setStatBase(Attributes::ATK, msg.readInt16("left atk"), false);
 
370
    PlayerInfo::setStatMod(Attributes::ATK, msg.readInt16("right atk"));
337
371
    PlayerInfo::updateAttrs();
338
372
 
339
373
    val = msg.readInt16("right matk");
340
 
    PlayerInfo::setStatBase(MATK, val, false);
 
374
    PlayerInfo::setStatBase(Attributes::MATK, val, false);
341
375
 
342
376
    val = msg.readInt16("left matk");
343
 
    PlayerInfo::setStatMod(MATK, val);
344
 
 
345
 
    PlayerInfo::setStatBase(DEF, msg.readInt16("left def"), false);
346
 
    PlayerInfo::setStatMod(DEF, msg.readInt16("right def"));
347
 
 
348
 
    PlayerInfo::setStatBase(MDEF, msg.readInt16("left mdef"), false);
349
 
    PlayerInfo::setStatMod(MDEF, msg.readInt16("right mdef"));
350
 
 
351
 
    PlayerInfo::setStatBase(HIT, msg.readInt16("hit"));
352
 
 
353
 
    PlayerInfo::setStatBase(FLEE, msg.readInt16("flee"), false);
354
 
    PlayerInfo::setStatMod(FLEE, msg.readInt16("flee2/10"));
355
 
 
356
 
    PlayerInfo::setStatBase(CRIT, msg.readInt16("crit/10"));
 
377
    PlayerInfo::setStatMod(Attributes::MATK, val);
 
378
 
 
379
    PlayerInfo::setStatBase(Attributes::DEF, msg.readInt16("left def"), false);
 
380
    PlayerInfo::setStatMod(Attributes::DEF, msg.readInt16("right def"));
 
381
 
 
382
    PlayerInfo::setStatBase(Attributes::MDEF,
 
383
        msg.readInt16("left mdef"), false);
 
384
    PlayerInfo::setStatMod(Attributes::MDEF, msg.readInt16("right mdef"));
 
385
 
 
386
    PlayerInfo::setStatBase(Attributes::HIT, msg.readInt16("hit"));
 
387
 
 
388
    PlayerInfo::setStatBase(Attributes::FLEE, msg.readInt16("flee"), false);
 
389
    PlayerInfo::setStatMod(Attributes::FLEE, msg.readInt16("flee2/10"));
 
390
 
 
391
    PlayerInfo::setStatBase(Attributes::CRIT, msg.readInt16("crit/10"));
357
392
 
358
393
    PlayerInfo::setAttribute(Attributes::ATTACK_DELAY,
359
394
        msg.readInt16("attack speed"));
436
471
    msg.readInt16("value");
437
472
}
438
473
 
 
474
void PlayerHandler::processPlayerSkillMessage(Net::MessageIn &msg)
 
475
{
 
476
    // +++ need show this message
 
477
    msg.readInt32("type");
 
478
}
 
479
 
 
480
void PlayerHandler::setStat(const int type,
 
481
                            const int base,
 
482
                            const int mod,
 
483
                            const bool notify) const
 
484
{
 
485
    Ea::PlayerHandler::setStat(type, base, mod, notify);
 
486
}
 
487
 
439
488
}  // namespace EAthena