1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | case PACKET_ADD: // Spending a stat point on a skill { if (this->state < EOClient::PlayingModal) return false; unsigned short *stat; int action = reader.GetChar(); int stat_id = reader.GetShort(); switch (action) { case SKILL_LEVEL: { UTIL_PTR_LIST_FOREACH(this->player->character->spells, Character_Spell, spl) { if(spl->id == stat_id) { if(spl->level >= 100) { return false; } ++spl->level; --this->player->character->skillpoints; reply.SetID(PACKET_STATSKILL, PACKET_ACCEPT); reply.AddShort(this->player->character->skillpoints); reply.AddShort(stat_id); reply.AddShort(spl->level); CLIENT_SEND(reply); } } } break; case STAT_LEVEL: { if(this->player->character->statpoints <= 0) { return false; } switch (stat_id) { case 1: stat = &this->player->character->str; break; case 2: stat = &this->player->character->intl; break; case 3: stat = &this->player->character->wis; break; case 4: stat = &this->player->character->agi; break; case 5: stat = &this->player->character->con; break; case 6: stat = &this->player->character->cha; break; default: return false; } ++(*stat); --this->player->character->statpoints; this->player->character->CalculateStats(); reply.SetID(PACKET_STATSKILL, PACKET_PLAYER); reply.AddShort(this->player->character->statpoints); reply.AddShort(this->player->character->str); reply.AddShort(this->player->character->intl); reply.AddShort(this->player->character->wis); reply.AddShort(this->player->character->agi); reply.AddShort(this->player->character->con); reply.AddShort(this->player->character->cha); reply.AddShort(this->player->character->maxhp); reply.AddShort(this->player->character->maxtp); reply.AddShort(this->player->character->maxsp); reply.AddShort(this->player->character->maxweight); reply.AddShort(this->player->character->mindam); reply.AddShort(this->player->character->maxdam); reply.AddShort(this->player->character->accuracy); reply.AddShort(this->player->character->evade); reply.AddShort(this->player->character->armor); CLIENT_SEND(reply); } break; } } break; |