public IEnumerator <KeyValuePair <TKey, TVal> > GetEnumerator()
    {
        ListDictionary <TKey, TVal> tKeys = null;

        for (int i = 0; i < tKeys.vals.Count; i++)
        {
            yield return(tKeys.GetByIndex(i));
        }
    }
示例#2
0
        void ChatCommandAid(BasePlayer player, string command, string[] args)
        {
            if (!permission.UserHasPermission(player.userID.ToString(), "unwound.canuse"))
            {
                //if (!popupsEnabled)
                SendReply(player, localization["PermissionMissing"]);
                //else
                //    PopupNotifications.Call("CreatePopupNotification", localization["PermissionMissing"], player);

                return;
            }
            else if (!player.IsWounded())
            {
                //if (!popupsEnabled)
                SendReply(player, localization["NotWounded"]);
                //else
                //    PopupNotifications.Call("CreatePopupNotification", localization["NotWounded"], player);

                return;
            }
            else if (canCallMedicOncePerWounded &&
                     waitTillMedic > 0 &&
                     !CheckCanCall(player))
            {
                return;
            }

            if (args.Length > 0 &&
                args[0] == "0" ||
                args.Length > 0 &&
                IsUInt(args[0]) &&
                !ecoSettings.Contains(Convert.ToUInt32(args[0])) &&
                !economicsEnabled &&
                args[0] != "?")
            {
                args = new string[0];
            }

            double playerMoney = 0.0;

            if (args.Length == 0 &&
                economicsEnabled &&
                forceEconomics ||
                args.Length == 1 &&
                args[0] == "?" &&
                economicsEnabled)
            {
                playerMoney = (double)Economics.Call("GetPlayerMoney", player.userID);

                uint test = 0;

                for (int i = 0; i < ecoSettings.Count; i++)
                {
                    if (playerMoney >= ecoSettings.GetByIndex(i).Key&&
                        test < ecoSettings.GetByIndex(i).Key)
                    {
                        test = ecoSettings.GetByIndex(i).Key;
                    }
                    else if (i + 1 == ecoSettings.Count &&
                             test == 0 &&
                             forceEconomics)
                    {
                        test = ecoSettings.GetByIndex(0).Key;
                    }
                }

                if (forceEconomics ||
                    test != 0)
                {
                    args = new string[1] {
                        test.ToString()
                    }
                }
                ;
                else if (args.Length == 1 &&
                         args[0] == "?")
                {
                    args = new string[0];
                }
            }

            if (waitTillMedic > 0 ||
                Economics != null &&
                economicsEnabled &&
                forceEconomics)
            {
                if (Economics != null &&
                    economicsEnabled &&
                    args.Length >= 1 &&
                    IsUInt(args[0]))
                {
                    if (playerMoney >= Convert.ToDouble(args[0]))
                    {
                        Economics.Call("Withdraw", player.userID, Convert.ToDouble(args[0]));

                        if (ecoSettings[Convert.ToUInt32(args[0])] > 0)
                        {
                            //if (!popupsEnabled)
                            SendReply(player, String.Format(localization["TheMedicIsComing"], ecoSettings[Convert.ToUInt32(args[0])].ToString()));
                            //else
                            //    PopupNotifications.Call("CreatePopupNotification", String.Format(localization["TheMedicIsComing"], ecoSettings[Convert.ToUInt32(args[0])].ToString()), player);

                            Action timed = new Action(() => TimedMedic(player.userID));

                            timer.In(ecoSettings[Convert.ToUInt32(args[0])], timed);
                        }
                        else
                        {
                            called.Remove(player.userID);

                            if (!MedicGetsYouUp(player))
                            {
                                switch (Oxide.Core.Random.Range(0, 1))
                                {
                                case 0:
                                    //if (!popupsEnabled)
                                    SendReply(player, localization["MedicToLate"]);
                                    //else
                                    //    PopupNotifications.Call("CreatePopupNotification", localization["MedicToLate"], player);
                                    break;

                                case 1:
                                    //if (!popupsEnabled)
                                    SendReply(player, localization["MedicIncompetent"]);
                                    //else
                                    //    PopupNotifications.Call("CreatePopupNotification", localization["MedicIncompetent"], player);
                                    break;
                                }

                                return;
                            }

                            player.StopWounded();

                            player.ChangeHealth(player.StartHealth());

                            player.metabolism.bleeding.value = 0f;

                            //if (!popupsEnabled)
                            SendReply(player, localization["Survived"]);
                            //else
                            //    PopupNotifications.Call("CreatePopupNotification", localization["Survived"], player);
                        }
                    }
                    else
                    {
                        //if (!popupsEnabled)
                        SendReply(player, String.Format((forceEconomics ? localization["NotEnoughMoney_ForcedEco"] : localization["NotEnoughMoney"]), playerMoney.ToString("0"), args[0], waitTillMedic.ToString()));
                        //else
                        //    PopupNotifications.Call("CreatePopupNotification", String.Format((forceEconomics ? localization["NotEnoughMoney_ForcedEco"] : localization["NotEnoughMoney"]), playerMoney.ToString("0"), args[0], waitTillMedic.ToString()), player);

                        if (!forceEconomics)
                        {
                            Action timed = new Action(() => TimedMedic(player.userID));

                            timer.In(waitTillMedic, timed);
                        }
                        else
                        {
                            called.Remove(player.userID);
                        }
                    }
                }
                else if (!forceEconomics)
                {
                    //if (!popupsEnabled)
                    SendReply(player, String.Format(localization["TheMedicIsComing"], waitTillMedic.ToString()));
                    //else
                    //    PopupNotifications.Call("CreatePopupNotification", String.Format(localization["TheMedicIsComing"], waitTillMedic.ToString()), player);

                    Action timed = new Action(() => TimedMedic(player.userID));

                    timer.In(waitTillMedic, timed);
                }
            }
            else
            {
                if (!MedicGetsYouUp(player))
                {
                    switch (Oxide.Core.Random.Range(0, 1))
                    {
                    case 0:
                        //if (!popupsEnabled)
                        SendReply(player, localization["MedicToLate"]);
                        //else
                        //    PopupNotifications.Call("CreatePopupNotification", localization["MedicToLate"], player);
                        break;

                    case 1:
                        //if (!popupsEnabled)
                        SendReply(player, localization["MedicIncompetent"]);
                        //else
                        //    PopupNotifications.Call("CreatePopupNotification", localization["MedicIncompetent"], player);
                        break;
                    }

                    return;
                }

                player.StopWounded();

                player.ChangeHealth(player.StartHealth());

                player.metabolism.bleeding.value = 0f;

                //if (!popupsEnabled)
                SendReply(player, localization["Survived"]);
                //else
                //    PopupNotifications.Call("CreatePopupNotification", localization["Survived"], player);
            }
        }