コード例 #1
0
ファイル: GameScene.cs プロジェクト: ElijahLOMCN/mir2
        private void GuildBuffList(S.GuildBuffList p)
        {
            for (int i = 0; i < p.GuildBuffs.Count; i++)
            {
                GuildBuffDialog.GuildBuffInfos.Add(p.GuildBuffs[i]);
            }
            for (int i = 0; i < p.ActiveBuffs.Count; i++)
            {
                //if (p.ActiveBuffs[i].ActiveTimeRemaining > 0)
                //    p.ActiveBuffs[i].ActiveTimeRemaining = Convert.ToInt32(CMain.Time / 1000) + (p.ActiveBuffs[i].ActiveTimeRemaining * 60);
                if (UpdateGuildBuff(p.ActiveBuffs[i], p.Remove == 1)) continue;
                if (!(p.Remove == 1))
                {
                    GuildBuffDialog.EnabledBuffs.Add(p.ActiveBuffs[i]);
                    //CreateGuildBuff(p.ActiveBuffs[i]);
                }
            }

            for (int i = 0; i < GuildBuffDialog.EnabledBuffs.Count; i++)
            {
                if (GuildBuffDialog.EnabledBuffs[i].Info == null)
                {
                    GuildBuffDialog.EnabledBuffs[i].Info = GuildBuffDialog.FindGuildBuffInfo(GuildBuffDialog.EnabledBuffs[i].Id);
                }
            }

            Buff buff = Buffs.FirstOrDefault(e => e.Type == BuffType.GuildBuff);

            if (GuildBuffDialog.EnabledBuffs.Any(e => e.Active))
            {
                if (buff == null)
                {
                    buff = new Buff { Type = BuffType.GuildBuff, ObjectID = User.ObjectID, Caster = "Guild", Infinite = true };

                    Buffs.Add(buff);
                    CreateBuff(buff);
                }

                GuildBuffDialog.UpdateActiveStats();
            }
            else
            {
                RemoveBuff(new S.RemoveBuff { ObjectID = User.ObjectID, Type = BuffType.GuildBuff });
            }

            User.RefreshStats();
        }
コード例 #2
0
ファイル: GameScene.cs プロジェクト: ElijahLOMCN/mir2
        private void AddBuff(S.AddBuff p)
        {
            Buff buff = new Buff { Type = p.Type, Caster = p.Caster, Expire = CMain.Time + p.Expire, Values = p.Values, Infinite = p.Infinite, ObjectID = p.ObjectID, Visible = p.Visible };

            if (buff.ObjectID == User.ObjectID)
            {
                for (int i = 0; i < Buffs.Count; i++)
                {
                    if (Buffs[i].Type != buff.Type) continue;

                    Buffs[i] = buff;
                    User.RefreshStats();
                    ShowMentalState(buff);
                    return;
                }

                Buffs.Add(buff);
                CreateBuff(buff);
                User.RefreshStats();
                ShowMentalState(buff);               
            }

            if (!buff.Visible || buff.ObjectID <= 0) return;

            for (int i = MapControl.Objects.Count - 1; i >= 0; i--)
            {
                MapObject ob = MapControl.Objects[i];
                if (ob.ObjectID != buff.ObjectID) continue;
                if ((ob is PlayerObject) || (ob is MonsterObject))
                {
                    if (!ob.Buffs.Contains(buff.Type))
                    {
                        ob.Buffs.Add(buff.Type);
                    }

                    ob.AddBuffEffect(buff.Type);
                    return;
                }
            }
        }
コード例 #3
0
ファイル: GameScene.cs プロジェクト: ElijahLOMCN/mir2
        private void ShowMentalState(Buff buff)
        {
            if (buff.Type == BuffType.MentalState)
            {
                switch (buff.Values[0])
                {
                    case 0:
                        ChatDialog.ReceiveChat("Mentalstate: Agressive.", ChatType.Hint);
                        break;
                    case 1:
                        ChatDialog.ReceiveChat("Mentalstate: Trick shot.", ChatType.Hint);
                        break;
                    case 2:
                        ChatDialog.ReceiveChat("Mentalstate: Group mode.", ChatType.Hint);
                        break;
                }

            }
        }
コード例 #4
0
ファイル: GameScene.cs プロジェクト: ElijahLOMCN/mir2
        public void CreateBuff(Buff buff)
        {
            string text = "";
            int buffImage = BuffImage(buff.Type);

            MLibrary buffLibrary = Libraries.BuffIcon;

            if (buffImage >= 20000)
            {
                buffImage -= 20000;
                buffLibrary = Libraries.MagIcon;
            }

            if (buffImage >= 10000)
            {
                buffImage -= 10000;
                buffLibrary = Libraries.Prguse2;
            }

            MirImageControl image = new MirImageControl
            {
                Library = buffLibrary,
                Parent = this,
                Visible = true,
                Sort = false,
                Index = buffImage
            };

            new MirLabel
            {
                DrawFormat = TextFormatFlags.Right,
                NotControl = true,
                ForeColour = Color.Yellow,
                Location = new Point(-7, 10),
                Size = new Size(30, 20),
                Parent = image
            };
            
            switch (buff.Type)
            {
                case BuffType.UltimateEnhancer:
                    if (GameScene.User.Class == MirClass.Wizard || GameScene.User.Class == MirClass.Archer)
                    {
                        text = string.Format("MC increased by 0-{0} for {1} seconds.", buff.Values[0], (buff.Expire - CMain.Time) / 1000);
                    }
                    else if (GameScene.User.Class == MirClass.Taoist)
                    {
                        text = string.Format("SC increased by 0-{0} for {1} seconds.", buff.Values[0], (buff.Expire - CMain.Time) / 1000);
                    }
                    else
                    {
                        text = string.Format("DC increased by 0-{0} for {1} seconds.", buff.Values[0], (buff.Expire - CMain.Time) / 1000);
                    }
                    break;
                case BuffType.Impact:
                    text = string.Format("DC increased by 0-{0} for {1} seconds.", buff.Values[0], (buff.Expire - CMain.Time) / 1000);
                    break;
                case BuffType.Magic:
                    text = string.Format("MC increased by 0-{0} for {1} seconds.", buff.Values[0], (buff.Expire - CMain.Time) / 1000);
                    break;
                case BuffType.Taoist:
                    text = string.Format("SC increased by 0-{0} for {1} seconds.", buff.Values[0], (buff.Expire - CMain.Time) / 1000);
                    break;
                case BuffType.Storm:
                    text = string.Format("A.Speed increased by {0} for {1} seconds.", buff.Values[0], (buff.Expire - CMain.Time) / 1000);
                    break;
                case BuffType.HealthAid:
                    text = string.Format("HP increased by {0} for {1} seconds.", buff.Values[0], (buff.Expire - CMain.Time) / 1000);
                    break;
                case BuffType.ManaAid:
                    text = string.Format("MP increased by {0} for {1} seconds.", buff.Values[0], (buff.Expire - CMain.Time) / 1000);
                    break;
            }

            if (text != "") GameScene.Scene.ChatDialog.ReceiveChat(text, ChatType.Hint);
            BuffList.Insert(0, image);
        }
コード例 #5
0
ファイル: GameScene.cs プロジェクト: WillMcKill/MirRage
        private void AddBuff(S.AddBuff p)
        {
            Buff buff = new Buff {Type = p.Type, Caster = p.Caster, Expire = CMain.Time + p.Expire, Value = p.Value, Infinite = p.Infinite};
            for (int i = 0; i < Buffs.Count; i++)
            {
                if (Buffs[i].Type != buff.Type) continue;

                Buffs[i] = buff;
                User.RefreshStats();
                return;
            }
            Buffs.Add(buff);
            CreateBuff(buff);
            User.RefreshStats();
        }
コード例 #6
0
ファイル: GameScene.cs プロジェクト: WillMcKill/MirRage
        public void CreateBuff(Buff buff)
        {
            MirImageControl image =  new MirImageControl
                {
                    Library = Libraries.Prguse,
                    Parent = this,
                    Visible = true,
                };

            new MirLabel
                {
                    DrawFormat = TextFormatFlags.Right,
                    NotControl = true,
                    ForeColour = Color.Yellow,
                    Location = new Point(-7, 10),
                    Size = new Size(30, 20),
                    Parent = image
                };

            switch (buff.Type)
            {
                case BuffType.Teleport:
                    image.Index = 885;
                    break;
                case BuffType.Hiding:
                    image.Index = 884;
                    break;
                case BuffType.Haste:
                    image.Index = 880;
                    break;
                case BuffType.LightBody:
                    image.Index = 882;
                    break;
                case BuffType.SoulShield:
                    image.Index = 870;
                    break;
                case BuffType.BlessedArmour:
                    image.Index = 871;
                    break;
                case BuffType.ProtectionField:
                    image.Index = 861;
                    break;
                case BuffType.Rage:
                    image.Index = 860;
                    break;
            }

            BuffList.Insert(0, image);
        }