Ejemplo n.º 1
0
        public void AwardMemberExp(Player Killer, Monster Target, Int32 Exp)
        {
            if (!IsTeamMember(Killer.UniqId))
            {
                return;
            }

            Int32 MonsterLvl = Target.Level;

            List <Player> ValidMembers = new List <Player>();

            if (Killer.UniqId == Leader.UniqId || Killer.Map != Leader.Map)
            {
                goto Members;
            }

            if (!Leader.IsAlive())
            {
                goto Members;
            }

            if (Math.Abs(Leader.X - Target.X) > RANGE_EXP_SHARE ||
                Math.Abs(Leader.Y - Target.Y) > RANGE_EXP_SHARE)
            {
                goto Members; // out of share range
            }
            ValidMembers.Add(Leader);

Members:
            for (Int32 i = 0; i < Members.Length; i++)
            {
                if (Members[i] == null)
                {
                    continue;
                }

                if (Killer.UniqId == Members[i].UniqId || Killer.Map != Members[i].Map)
                {
                    continue;
                }

                if (!Members[i].IsAlive())
                {
                    continue;
                }

                if (Math.Abs(Members[i].X - Target.X) > RANGE_EXP_SHARE ||
                    Math.Abs(Members[i].Y - Target.Y) > RANGE_EXP_SHARE)
                {
                    continue; // out of share range
                }
                ValidMembers.Add(Members[i]);
            }

            foreach (Player Member in ValidMembers)
            {
                UInt32 AddExp = Battle.AdjustExp(Exp, Member, Target);

                //Max Exp
                if (AddExp > Member.Level * MAX_TEAM_EXP_TIMES)
                {
                    AddExp = (UInt32)(Member.Level * MAX_TEAM_EXP_TIMES);
                }

                //Double Exp
                if (Member.Mate == Killer.Name)
                {
                    AddExp *= 2;
                }

                if (IsTeamWithNewbie(Target))
                {
                    AddExp *= 2;
                }

                if (Member.Profession >= 133 && Member.Profession <= 135)
                {
                    AddExp *= 2;
                }

                Member.SendSysMsg(StrRes.STR_TEAM_EXPERIENCE, Member.AddExp(AddExp, true));
            }
            ValidMembers.Clear();
        }