예제 #1
0
파일: MapObject.cs 프로젝트: ufaith/cmir2
 public Buff(Buff buff)
 {
     Type = buff.Type;
     Caster = buff.Caster;
     Visible = buff.Visible;
     ObjectID = buff.ObjectID;
     ExpireTime = buff.ExpireTime;
     Value = buff.Value;
     Infinite = buff.Infinite;
 }
예제 #2
0
        public override void AddBuff(Buff b)
        {
            if (Buffs.Any(d => d.Infinite && d.Type == b.Type)) return; //cant overwrite infinite buff with regular buff

            string caster = b.Caster != null ? b.Caster.Name : string.Empty;

            if (b.Values == null) b.Values = new int[1];

            S.AddBuff addBuff = new S.AddBuff { Type = b.Type, Caster = caster, Expire = b.ExpireTime - Envir.Time, Values = b.Values, Infinite = b.Infinite, ObjectID = ObjectID, Visible = b.Visible };

            if (b.Visible) Broadcast(addBuff);

            base.AddBuff(b);
            RefreshAll();
        }
예제 #3
0
파일: ItemObject.cs 프로젝트: quttap/mir2
 public override void AddBuff(Buff b)
 {
     throw new NotSupportedException();
 }
예제 #4
0
파일: MapObject.cs 프로젝트: ufaith/cmir2
        public virtual void AddBuff(Buff b)
        {
            switch (b.Type)
            {
                case BuffType.MoonLight:
                case BuffType.Hiding:
                case BuffType.DarkBody:
                    Hidden = true;

                    if (b.Type == BuffType.MoonLight || b.Type == BuffType.DarkBody) Sneaking = true;

                    for (int y = CurrentLocation.Y - Globals.DataRange; y <= CurrentLocation.Y + Globals.DataRange; y++)
                    {
                        if (y < 0) continue;
                        if (y >= CurrentMap.Height) break;

                        for (int x = CurrentLocation.X - Globals.DataRange; x <= CurrentLocation.X + Globals.DataRange; x++)
                        {
                            if (x < 0) continue;
                            if (x >= CurrentMap.Width) break;
                            if (x < 0 || x >= CurrentMap.Width) continue;

                            Cell cell = CurrentMap.GetCell(x, y);

                            if (!cell.Valid || cell.Objects == null) continue;

                            for (int i = 0; i < cell.Objects.Count; i++)
                            {
                                MapObject ob = cell.Objects[i];
                                if (ob.Race != ObjectType.Monster) continue;

                                if (ob.Target == this && (!ob.CoolEye || ob.Level < Level)) ob.Target = null;
                            }
                        }
                    }
                    break;
            }

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

                Buffs[i] = b;
                return;
            }

            Buffs.Add(b);
        }
예제 #5
0
        public void UnpauseBuff(Buff b)
        {
            if (!b.Paused) return;

            b.ExpireTime = b.ExpireTime + Envir.Time;
            b.Paused = false;
            Enqueue(new S.AddBuff { Type = b.Type, Caster = Name, Expire = b.ExpireTime - Envir.Time, Values = b.Values, Infinite = b.Infinite, ObjectID = ObjectID, Visible = b.Visible });
        }
예제 #6
0
        public CharacterInfo(BinaryReader reader)
        {
            Index = reader.ReadInt32();
            Name = reader.ReadString();

            Level = reader.ReadByte();
            Class = (MirClass) reader.ReadByte();
            Gender = (MirGender) reader.ReadByte();
            Hair = reader.ReadByte();

            CreationIP = reader.ReadString();
            CreationDate = DateTime.FromBinary(reader.ReadInt64());

            Banned = reader.ReadBoolean();
            BanReason = reader.ReadString();
            ExpiryDate = DateTime.FromBinary(reader.ReadInt64());

            LastIP = reader.ReadString();
            LastDate = DateTime.FromBinary(reader.ReadInt64());

            Deleted = reader.ReadBoolean();
            DeleteDate = DateTime.FromBinary(reader.ReadInt64());

            CurrentMapIndex = reader.ReadInt32();
            CurrentLocation = new Point(reader.ReadInt32(), reader.ReadInt32());
            Direction = (MirDirection)reader.ReadByte();
            BindMapIndex = reader.ReadInt32();
            BindLocation = new Point(reader.ReadInt32(), reader.ReadInt32());

            HP = reader.ReadUInt16();
            MP = reader.ReadUInt16();
            Experience = reader.ReadInt64();

            AMode = (AttackMode) reader.ReadByte();
            PMode = (PetMode) reader.ReadByte();

            if (Envir.LoadVersion > 34)
            {
                PKPoints = reader.ReadInt32();
            }

            int count = reader.ReadInt32();

            Array.Resize(ref Inventory, count);

            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean()) continue;
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < Inventory.Length)
                    Inventory[i] = item;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean()) continue;
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < Equipment.Length)
                    Equipment[i] = item;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean()) continue;
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < QuestInventory.Length)
                    QuestInventory[i] = item;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                UserMagic magic = new UserMagic(reader);
                if (magic.Info == null) continue;
                Magics.Add(magic);
            }

            if (Envir.LoadVersion < 2) return;

            Thrusting = reader.ReadBoolean();
            HalfMoon = reader.ReadBoolean();
            CrossHalfMoon = reader.ReadBoolean();
            DoubleSlash = reader.ReadBoolean();

            if(Envir.LoadVersion > 46)
            {
                MentalState = reader.ReadByte();
            }

            if (Envir.LoadVersion < 4) return;

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
                Pets.Add(new PetInfo(reader));

            if (Envir.LoadVersion < 5) return;

            AllowGroup = reader.ReadBoolean();

            if (Envir.LoadVersion < 12) return;

            if (Envir.LoadVersion == 12) count = reader.ReadInt32();

            for (int i = 0; i < Globals.FlagIndexCount; i++)
                Flags[i] = reader.ReadBoolean();

            if (Envir.LoadVersion > 27)
                GuildIndex = reader.ReadInt32();

            if (Envir.LoadVersion > 30)
                AllowTrade = reader.ReadBoolean();

            if (Envir.LoadVersion > 33)
            {
                count = reader.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    QuestProgressInfo quest = new QuestProgressInfo(reader);
                    if (SMain.Envir.BindQuest(quest))
                        CurrentQuests.Add(quest);
                }
            }

            if(Envir.LoadVersion > 42)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Buff buff = new Buff(reader);

                    if (Envir.LoadVersion == 51)
                    {
                        buff.Caster = SMain.Envir.GetObject(reader.ReadUInt32());
                    }

                    Buffs.Add(buff);
                }
            }

            if(Envir.LoadVersion > 43)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                    Mail.Add(new MailInfo(reader, Envir.LoadVersion, Envir.LoadCustomVersion));
            }

            //IntelligentCreature
            if (Envir.LoadVersion > 44)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    UserIntelligentCreature creature = new UserIntelligentCreature(reader);
                    if (creature.Info == null) continue;
                    IntelligentCreatures.Add(creature);
                }

                if (Envir.LoadVersion == 45)
                {
                    var old1 = (IntelligentCreatureType)reader.ReadByte();
                    var old2 = reader.ReadBoolean();
                }

                PearlCount = reader.ReadInt32();
            }

            if (Envir.LoadVersion > 49)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                    CompletedQuests.Add(reader.ReadInt32());
            }

            if (Envir.LoadVersion > 50 && Envir.LoadVersion < 54)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Poison poison = new Poison(reader);

                    if (Envir.LoadVersion == 51)
                    {
                        poison.Owner = SMain.Envir.GetObject(reader.ReadUInt32());
                    }

                    Poisons.Add(poison);
                }
            }

            if (Envir.LoadVersion > 56)
            {
                if (reader.ReadBoolean()) CurrentRefine = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                  if (CurrentRefine != null)
                    SMain.Envir.BindItem(CurrentRefine);

                CollectTime = reader.ReadInt64();
                CollectTime += SMain.Envir.Time;
            }

            if (Envir.LoadVersion > 58)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                    Friends.Add(new FriendInfo(reader));
            }

            if (Envir.LoadVersion > 59)
            {
                Married = reader.ReadInt32();
                MarriedDate = DateTime.FromBinary(reader.ReadInt64());
                Mentor = reader.ReadInt32();
                MentorDate = DateTime.FromBinary(reader.ReadInt64());
                isMentor = reader.ReadBoolean();
                MentorExp = reader.ReadInt64();
            }
        }
예제 #7
0
 public override void AddBuff(Buff b)
 {
     base.AddBuff(b);
     RefreshAll();
 }
예제 #8
0
        public void PauseBuff(Buff b)
        {
            if (b.Paused) return;

            b.ExpireTime = b.ExpireTime - Envir.Time;
            b.Paused = true;
            Enqueue(new S.RemoveBuff { Type = b.Type, ObjectID = ObjectID });
        }
예제 #9
0
 public override void AddBuff(Buff b)
 {
     base.AddBuff(b);
     Enqueue(new S.AddBuff { Type = b.Type, Caster = b.Caster.Name, Expire = b.ExpireTime - Envir.Time, Value = b.Value, Infinite = b.Infinite});
     RefreshStats();
 }
예제 #10
0
        public void UpdateBuff(Buff b)
        {
            S.AddBuff addBuff = new S.AddBuff { Type = b.Type, Caster = b.Caster.Name, Expire = b.ExpireTime - Envir.Time, Value = b.Value, Infinite = b.Infinite, ObjectID = ObjectID, Visible = b.Visible };
            Enqueue(addBuff);

            if (b.Visible) Broadcast(addBuff);

            RefreshStats();
        }
예제 #11
0
        public override void AddBuff(Buff b)
        {
            if (Buffs.Any(d => d.Infinite && d.Type == b.Type)) return; //cant overwrite infinite buff with regular buff

            base.AddBuff(b);

            S.AddBuff addBuff = new S.AddBuff { Type = b.Type, Caster = b.Caster.Name, Expire = b.ExpireTime - Envir.Time, Value = b.Value, Infinite = b.Infinite, ObjectID = ObjectID, Visible = b.Visible };
            Enqueue(addBuff);

            if (b.Visible) Broadcast(addBuff);

            RefreshStats();
        }
예제 #12
0
파일: MapObject.cs 프로젝트: ufaith/cmir2
        public virtual void AddBuff(Buff b)
        {
            switch (b.Type)
            {
            case BuffType.MoonLight:
            case BuffType.Hiding:
            case BuffType.DarkBody:
                Hidden = true;

                if (b.Type == BuffType.MoonLight || b.Type == BuffType.DarkBody)
                {
                    Sneaking = true;
                }

                for (int y = CurrentLocation.Y - Globals.DataRange; y <= CurrentLocation.Y + Globals.DataRange; y++)
                {
                    if (y < 0)
                    {
                        continue;
                    }
                    if (y >= CurrentMap.Height)
                    {
                        break;
                    }

                    for (int x = CurrentLocation.X - Globals.DataRange; x <= CurrentLocation.X + Globals.DataRange; x++)
                    {
                        if (x < 0)
                        {
                            continue;
                        }
                        if (x >= CurrentMap.Width)
                        {
                            break;
                        }
                        if (x < 0 || x >= CurrentMap.Width)
                        {
                            continue;
                        }

                        Cell cell = CurrentMap.GetCell(x, y);

                        if (!cell.Valid || cell.Objects == null)
                        {
                            continue;
                        }

                        for (int i = 0; i < cell.Objects.Count; i++)
                        {
                            MapObject ob = cell.Objects[i];
                            if (ob.Race != ObjectType.Monster)
                            {
                                continue;
                            }

                            if (ob.Target == this && (!ob.CoolEye || ob.Level < Level))
                            {
                                ob.Target = null;
                            }
                        }
                    }
                }
                break;
            }


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

                Buffs[i] = b;
                return;
            }

            Buffs.Add(b);
        }
예제 #13
0
 public override void AddBuff(Buff b)
 {
     throw new NotSupportedException();
 }