Esempio n. 1
0
        private void NewCharacter()
        {
            if (MirDB.StartPoints.Count == 0)
            {
                return;
            }

            Level    = Settings.StartLevel;
            HairType = 1;

            for (int I = 0; I < MirDB.StartItems.Count; I++)
            {
                if (CorrectStartItem(MirDB.StartItems[I]))
                {
                    AddBagItem(MirDB.NewItem(MirDB.StartItems[I]));
                }
            }


            SafeZoneInfo SZI = MirDB.StartPoints[Envir.Rand.Next(MirDB.StartPoints.Count)];

            MapIndex = SZI.MapIndex;
            Location = SZI.Location;

            HomeMapIndex = MapIndex;
            HomeLocation = Location;

            RefreshAll();
            Recover(MaxHP, MaxMP);
        }
Esempio n. 2
0
 public Main()
 {
     InitializeComponent();
     MirDB.Start();
     MirEnvir.Envir.Start();
     MirNetwork.Network.Start();
 }
Esempio n. 3
0
        public void NewCharacter(C.NewCharacter P)
        {
            if (Stage != GameStage.Select)
            {
                return;
            }

            MirDB.CreateCharacter(P, this);
        }
Esempio n. 4
0
        public void Login(C.Login P)
        {
            if (Stage != GameStage.Login)
            {
                return;
            }

            MirDB.Login(P, this);
        }
Esempio n. 5
0
        public void ChangePassword(C.ChangePassword P)
        {
            if (Stage != GameStage.Login)
            {
                return;
            }

            MirDB.ChangePassword(P, this);
        }
Esempio n. 6
0
        public void NewAccount(C.NewAccount P)
        {
            if (Stage != GameStage.Login)
            {
                return;
            }

            MirDB.CreateAccount(P, this);
        }
Esempio n. 7
0
        public virtual void Drop()
        {
            DropInfo   DInfo;
            ItemObject FloorItem;
            int        Rate;

            for (int I = 0; I < MI.DropList.Count; I++)
            {
                DInfo = MI.DropList[I];

                Interlocked.Increment(ref DInfo.TotalCount);
                //for (int S = 0; S < 40; S++)
                Rate = (int)(DInfo.Rate / Settings.DropRate); if (Rate < 1)
                {
                    Rate = 1;
                }
                if (Envir.Rand.Next(Rate) == 0)
                {
                    if (DInfo.Group != 0)
                    {
                        List <DropInfo> TempList = MI.DropList.Where(D => D.Group == DInfo.Group && D.TriggerCount < DInfo.TriggerCount).ToList();

                        if (TempList.Count != 0)
                        {
                            DInfo = TempList[Envir.Rand.Next(TempList.Count)];
                        }
                    }
                    Interlocked.Increment(ref DInfo.TriggerCount);

                    if (DInfo.Item == MirDB.GoldItem)
                    {
                        if (DInfo.Amount <= 0)
                        {
                            continue;
                        }
                        else
                        {
                            FloorItem = new ItemObject(Envir.Rand.Next(DInfo.Amount / 2, DInfo.Amount + DInfo.Amount / 2), this);
                        }
                    }
                    else
                    {
                        FloorItem = new ItemObject(MirDB.NewItem(DInfo.Item), this);
                    }

                    FloorItem.Drop();
                }
            }
        }
Esempio n. 8
0
        public override bool Harvested(PlayerObject O)
        {
            if (!Dead || Skinned)
            {
                return(false);
            }

            if (Interlocked.Decrement(ref RemainingSkinCount) == 0)
            {
                DropInfo DInfo;
                UserItem TempItem;
                bool     FoundItem = false;
                int      Rate;

                for (int I = 0; I < MI.DropList.Count; I++)
                {
                    DInfo = MI.DropList[I];

                    Interlocked.Increment(ref DInfo.TotalCount);

                    Rate = (int)(DInfo.Rate / Settings.DropRate); if (Rate < 1)
                    {
                        Rate = 1;
                    }
                    if (Envir.Rand.Next(Rate) == 0)
                    {
                        if (DInfo.Group != 0)
                        {
                            List <DropInfo> TempList = MI.DropList.Where(D => D.Group == DInfo.Group && D.TriggerCount < DInfo.TriggerCount).ToList();

                            if (TempList.Count != 0)
                            {
                                DInfo = TempList[Envir.Rand.Next(TempList.Count)];
                            }
                        }
                        Interlocked.Increment(ref DInfo.TriggerCount);

                        if (DInfo.Item == MirDB.GoldItem)
                        {
                            if (DInfo.Amount <= 0)
                            {
                                continue;
                            }
                            else
                            {
                                O.GainGold(DInfo.Amount);
                            }
                        }
                        else
                        {
                            TempItem = MirDB.NewItem(DInfo.Item);
                            if (TempItem.Info.ItemType == MirItemType.Meat)
                            {
                                TempItem.CurrentDurability += Quality;
                            }
                            if (O.CanGainItem(TempItem))
                            {
                                O.GainItem(TempItem);
                            }
                            else
                            {
                                O.DropItem(TempItem);
                            }
                        }
                        FoundItem = true;
                    }
                }

                if (!FoundItem)
                {
                    O.ReceiveMessage("You found nothing.", MirChatType.RedSystem);
                }

                Skinned = true;
                Packet Pack = new S.ObjectSkeleton {
                    ObjectID = ObjectID
                };
                Broadcast(Pack);
            }

            return(true);
        }