Beispiel #1
0
        public CharacterCreationOutput(int baseAttributePoints, int baseSkillPoints)
        {
            PlayerName       = "Player";
            myBaseAttributes = new Dictionary <CharAttribute, int>();
            myBaseSkills     = new Dictionary <CharSkill, int>();

            foreach (CharAttribute attrib in CharAttribute.GetAll())
            {
                myBaseAttributes.Add(attrib, baseAttributePoints);
            }

            foreach (CharSkill skill in CharSkill.GetAll())
            {
                myBaseSkills.Add(skill, baseSkillPoints);
            }
        }
Beispiel #2
0
        public void SendCharacterCreate(CharacterCreationOutput output)
        {
            myClients[GameClient.ID].Nickname = output.PlayerName;

            BinaryWriter writer = GetWriter();

            writer.Write((byte)PacketID.CharacterCreate);
            writer.Write(output.PlayerName);
            writer.Write((ushort)CharAttribute.GetAll().Length);
            foreach (CharAttribute attrib in CharAttribute.GetAll())
            {
                writer.Write(attrib.ID);
                writer.Write((byte)output.GetAttributePoints(attrib));
            }
            writer.Write((ushort)CharSkill.GetAll().Length);
            foreach (CharSkill skill in CharSkill.GetAll())
            {
                writer.Write(skill.ID);
                writer.Write((byte)output.GetBaseSkillPoints(skill));
            }

            SendPacket();
        }
Beispiel #3
0
        public CharAttribDisplay(Character character)
        {
            Title = "Attributes and Skills";

            String str = "Attributes:";

            foreach (CharAttribute attrib in CharAttribute.GetAll())
            {
                String line = "\n  " + attrib.ToString();

                int baseVal = character.GetAttributeLevel(attrib, false);
                int currVal = character.GetAttributeLevel(attrib, true);
                int diff    = currVal - baseVal;

                while (line.Length < 20)
                {
                    line += " ";
                }

                line += ": " + currVal.ToString();

                while (line.Length < 26)
                {
                    line += " ";
                }

                line += "(" + (diff > 0 ? "+" : "") + diff.ToString() + ")";

                str += line;
            }

            str += "\n\nSkills:";
            foreach (CharSkill skill in CharSkill.GetAll())
            {
                String line = "\n  " + skill.ToString();

                int baseVal = character.GetSkillLevel(skill, false);
                int currVal = character.GetSkillLevel(skill, true);
                int diff    = currVal - baseVal;

                while (line.Length < 20)
                {
                    line += " ";
                }

                line += ": " + currVal.ToString();

                while (line.Length < 26)
                {
                    line += " ";
                }

                line += "(" + (diff > 0 ? "+" : "") + diff.ToString() + ")";

                str += line;
            }

            str += "\n\nHit Points: " + character.HitPoints + "/" + character.MaxHitPoints;
            str += "\nMana Level: " + character.ManaLevel + "/" + character.MaxManaLevel;
#if DEBUG
            str += "\nWalk Speed: " + character.WalkSpeed.ToString("F");
            str += "\nMana Regen: " + character.ManaRechargePeriod.ToString("F");
            str += "\nCast Delay: " + character.CastCooldownTime.ToString("F");
            str += "\nHeal Delay: " + character.FastHPRechargeDelay.ToString("F");
#endif

            myText = new UILabel(Font.Large)
            {
                Text     = str,
                Position = new Vector2(4, 4)
            };
            AddChild(myText);

            Width  = myText.Width + 8 + PaddingLeft + PaddingRight;
            Height = myText.Height + 8 + PaddingTop + PaddingBottom;
        }
Beispiel #4
0
        public AttributeCreation(CharacterCreation parent, CharacterCreationOutput output)
        {
            myParent = parent;
            myOutput = output;



            float y = 4;

            myPointsLabel = new UILabel(Font.Large, new Vector2(4, y));
            AddChild(myPointsLabel);
            UnusedPoints = GameClient.CharacterUnusedAttribPoints;

            y += 30;

            foreach (CharAttribute attrib in CharAttribute.GetAll())
            {
                var row = new AttribRow(this, attrib, myOutput);
                row.Top  = y;
                row.Left = 4;
                y       += 30;
                AddChild(row);
            }

            y += 20;

            var skills = CharSkill.GetAll();

            skillRows = new SkillRow[skills.Length];

            int i = 0;

            foreach (CharSkill skill in skills)
            {
                var row = new SkillRow(new Vector2(4, y), skill, myOutput);
                y           += 25;
                skillRows[i] = row;
                i++;
                AddChild(row);
            }

            var button = new UIButton(new Vector2(150, 20), new Vector2(300 - 150 - 4, y))
            {
                Text       = "Create Character",
                CentreText = true
            };

            AddChild(button);
            button.Click += new MouseButtonEventHandler(button_Click);

            var back = new UIButton(new Vector2(50, 20), new Vector2(4, y))
            {
                Text       = "Back",
                CentreText = true
            };

            back.Click += new MouseButtonEventHandler(back_Click);
            AddChild(back);

            y += 20;

            Width  = 300;
            Height = y + 4 + PaddingTop + PaddingBottom;
        }