Ejemplo n.º 1
0
        void c_ClientAddStatInfo(object sender, ClientAddStatEventArgs e)
        {
            Client      c        = (Client)sender;
            AddStatInfo statinfo = e.Info;

            if (c.MyCharacter.StatPoint >= statinfo.Amount)
            {
                int pointsleft = -1;
                int statafter  = -1;

                switch (statinfo.Stat)
                {
                case 1:     // dex
                    c.MyCharacter.StatPoint -= 1;
                    c.MyCharacter.Dexterity += 1;
                    statafter = c.MyCharacter.Dexterity;
                    break;

                case 2:     // str
                    c.MyCharacter.StatPoint -= 1;
                    c.MyCharacter.Strength  += 1;
                    statafter = c.MyCharacter.Strength;
                    break;

                case 3:     // sta

                    c.MyCharacter.StatPoint -= 1;
                    c.MyCharacter.Stamina   += 1;
                    statafter = c.MyCharacter.Stamina;
                    break;

                case 4:     // energy
                    c.MyCharacter.StatPoint -= 1;
                    c.MyCharacter.Energy    += 1;
                    statafter = c.MyCharacter.Energy;
                    break;
                }
                pointsleft = c.MyCharacter.StatPoint;

                byte[] bufferSendAddStat = PacketManager.SendAddStat(0, statinfo, pointsleft, statafter);
                c.Send(bufferSendAddStat);
            }
            else
            {
                byte[] bufferSendStatError = PacketManager.SendAddStat(3, statinfo, 0, 0);
                c.Send(bufferSendStatError);
            }

            byte[] bufferSendStats = PacketManager.SendStats(c.MyCharacter);
            c.Send(bufferSendStats);
        }
Ejemplo n.º 2
0
        void c_ClientAddStatInfo(object sender, ClientAddStatEventArgs e)
        {
            Client c = (Client)sender;
            AddStatInfo statinfo = e.Info;

            if (c.MyCharacter.StatPoint >= statinfo.Amount)
            {
                int pointsleft = -1;
                int statafter = -1;

                switch (statinfo.Stat)
                {
                    case 1: // dex
                        c.MyCharacter.StatPoint -= 1;
                        c.MyCharacter.Dexterity += 1;
                        statafter = c.MyCharacter.Dexterity;
                        break;

                    case 2: // str
                        c.MyCharacter.StatPoint -= 1;
                        c.MyCharacter.Strength += 1;
                        statafter = c.MyCharacter.Strength;
                        break;

                    case 3: // sta

                        c.MyCharacter.StatPoint -= 1;
                        c.MyCharacter.Stamina += 1;
                        statafter = c.MyCharacter.Stamina;
                        break;

                    case 4: // energy
                        c.MyCharacter.StatPoint -= 1;
                        c.MyCharacter.Energy += 1;
                        statafter = c.MyCharacter.Energy;
                        break;
                }
                pointsleft = c.MyCharacter.StatPoint;

                byte[] bufferSendAddStat = PacketManager.SendAddStat(0, statinfo, pointsleft, statafter);
                c.Send(bufferSendAddStat);
            }
            else
            {
                byte[] bufferSendStatError = PacketManager.SendAddStat(3, statinfo, 0, 0);
                c.Send(bufferSendStatError);
            }

            byte[] bufferSendStats = PacketManager.SendStats(c.MyCharacter);
            c.Send(bufferSendStats);
        }