示例#1
0
文件: Class1.cs 项目: IIITanbI/CART
        public char Classify(Tuple <SortedDictionary <char, double>, SortedDictionary <MyPair <char, char>, double> > classifier, List <char> feats)
        {
            var classes = classifier.Item1;
            var prob    = classifier.Item2;

            double _min = 1e10;
            char   _val = ' ';

            foreach (var c1 in classes.Keys)
            {
                double res  = -Math.Log(classes[c1]);
                double res1 = 0;
                foreach (var feat in feats)
                {
                    var pp = new MyPair <char, char>(c1, feat);
                    if (prob.ContainsKey(pp))
                    {
                        res1 += -Math.Log(prob[pp]);
                    }
                    else
                    {
                        res1 += -Math.Log(1e-7);
                    }
                }

                res += res1;
                if (res < _min)
                {
                    _min = res;
                    _val = c1;
                }
            }
            return(_val);
        }
示例#2
0
 IEnumerator Rotate(MyPair <Transform, float> input)
 {
     while (true)
     {
         input.First.Rotate(0, 0, 1 * input.Second * Time.deltaTime);
         yield return(null);
     }
 }
示例#3
0
 void InitComposeMessage()
 {
     ComposeTable.Clear();
     if (data.CompositeTable == null)
     {
         return;
     }
     foreach (KeyValuePair <int, int> composition in data.CompositeTable)
     {
         MyPair <int, int> temp = new MyPair <int, int>(composition.Key, composition.Value);
         ComposeTable.Add(temp);
     }
 }
示例#4
0
 public MyPair <int, int> a(string A_0, int A_1)
 {
     if (dh.a(A_0) < A_1)
     {
         try
         {
             MyList <v> list = PluginCore.cq.x.c["CraftInteractions"].b(2, k.a(A_0));
             if (list.Count != 0)
             {
                 foreach (v v in list)
                 {
                     if (k.e(v[6]) != 0)
                     {
                         CharFilterSkillType type = (CharFilterSkillType)k.e(v[6]);
                         if (PluginCore.cq.aw.get_CharacterFilter().get_Skills().get_Item(type).get_Training() == null)
                         {
                             return(null);
                         }
                     }
                     string            str  = k.b(v[0]);
                     string            str2 = k.b(v[1]);
                     MyPair <int, int> pair = this.a(str, 1);
                     if (pair != null)
                     {
                         return(pair);
                     }
                     pair = this.a(str2, 1);
                     if (pair != null)
                     {
                         return(pair);
                     }
                     int num  = dh.b(str);
                     int num2 = dh.b(str2);
                     if ((num != 0) && (num2 != 0))
                     {
                         return(new MyPair <int, int> {
                             a = num, b = num2
                         });
                     }
                 }
             }
             return(null);
         }
         catch (Exception)
         {
             return(null);
         }
     }
     return(null);
 }
示例#5
0
 public PrgState Execute(PrgState state)
 {
     try
     {
         int val = exp_file_id.Eval(state.GetSymTable());//what to eval
         MyPair <String, StreamReader> entry = state.GetFileTable().Lookup(val);
         entry.GetSecond().Close();
         state.GetFileTable().Delete(val, entry);
     }
     catch (Exception e)
     {
         throw new MyException("Something went wrong!");
     }
     return(state);
 }
示例#6
0
        public PrgState Execute(PrgState state)
        {
            MyIDictionary <int, MyPair <String, StreamReader> > fileTable = state.GetFileTable();

            foreach (MyIPair <String, StreamReader> ff in fileTable.Values())
            {
                if (ff.GetFirst().Equals(this.filename))
                {
                    throw new MyException("File already used");
                }
            }
            MyIDictionary <String, int> symTable = state.GetSymTable();
            StreamReader streamReader            = new StreamReader(this.filename);
            int          unq = ran++;
            MyPair <String, StreamReader> tup = new MyPair <String, StreamReader>(this.filename, streamReader);

            fileTable.Add(unq, tup);
            symTable.Add(var_file_id, unq);
            return(state);
        }
示例#7
0
文件: Class1.cs 项目: IIITanbI/CART
        public Tuple <SortedDictionary <char, double>, SortedDictionary <MyPair <char, char>, double> > Train(List <Tuple <string, char> > names)
        {
            var classes = new SortedDictionary <char, double>();
            var freq    = new SortedDictionary <MyPair <char, char>, double>();

            foreach (var pair in names)
            {
                string name  = pair.Item1;
                char   label = pair.Item2;

                if (!classes.ContainsKey(label))
                {
                    classes[label] = 0;
                }
                classes[label]++;

                foreach (var feature in GetFeatures(name))
                {
                    var kp = new MyPair <char, char>(label, feature);
                    if (!freq.ContainsKey(kp))
                    {
                        freq[kp] = 0;
                    }
                    freq[kp]++;
                }
            }


            foreach (var pair in freq.Keys.ToList())
            {
                freq[pair] = freq[pair] / classes[pair.Key];
            }
            foreach (var c in classes.Keys.ToList())
            {
                classes[c] /= names.Count;
            }
            return(new Tuple <SortedDictionary <char, double>, SortedDictionary <MyPair <char, char>, double> >(classes, freq));
        }
示例#8
0
文件: Class1.cs 项目: IIITanbI/CART
            public int CompareTo(MyPair <TKey, TValue> other)
            {
                int kc = Key.CompareTo(other.Key);
                int vc = Value.CompareTo(other.Value);

                if (kc == vc)
                {
                    return(kc);
                }
                if (kc == 1)
                {
                    return(kc);
                }
                if (kc == 0)
                {
                    return(vc);
                }
                if (kc == -1)
                {
                    return(kc);
                }

                return(Key.CompareTo(other.Key));
            }
示例#9
0
    private MySpell a(MySpell A_0)
    {
        if (A_0 == null)
        {
            return(null);
        }
        if (this.e.ContainsKey(A_0.Id))
        {
            return(this.e[A_0.Id].e.b);
        }
        bw.a a = new bw.a {
            e = new bw.b(bw.b.a.a)
        };
        bw.b b = new bw.b(bw.b.a.a)
        {
            b = PluginCore.cq.h.a(A_0)
        };
        if (b.b != null)
        {
            b.a = b.b.SkillWithSchool;
        }
        bw.b b2 = new bw.b(bw.b.a.b);
        foreach (int num in PluginCore.cq.j.e())
        {
            string str;
            if (PluginCore.cq.p.d(num) != null)
            {
                str = PluginCore.cq.p.d(num).g() + " [" + num.ToString() + "]";
            }
            else
            {
                str = num.ToString();
            }
            PluginCore.cq.n.a("Find debuff choice (" + str + "): Begin", e8.j);
            if (!dh.b(num) || (dh.c(num) != PluginCore.cg))
            {
                goto Label_03EA;
            }
            if (!fn.b(PluginCore.cq.aw.get_WorldFilter().get_Item(num)))
            {
                goto Label_03B9;
            }
            a1   a2 = PluginCore.cq.n.c(num);
            fn.a a3 = PluginCore.cq.n.d(num);
            if (((a2 != a1.c) && (a2 != a1.e)) && (((a2 != a1.f) && (a2 != a1.g)) && (a2 != a1.b)))
            {
                goto Label_0392;
            }
            if ((a2 != a1.b) || PluginCore.cq.z.a(num))
            {
                PluginCore.cq.n.a("Find debuff choice (" + str + "): Test 1 passed", e8.j);
                if (a3.g != null)
                {
                    PluginCore.cq.n.a("Find debuff choice (" + str + "): Test 2 passed", e8.j);
                    if (a3.g.RealFamily == A_0.RealFamily)
                    {
                        PluginCore.cq.n.a("Find debuff choice (" + str + "): Test 3 passed", e8.j);
                        if (b2.b != null)
                        {
                            PluginCore.cq.n.a("Find debuff choice (" + str + "): Test 4 passed", e8.j);
                            if (a3.g.Quality <= b2.b.Quality)
                            {
                                PluginCore.cq.n.a("Find debuff choice (" + str + "): Test 5 passed", e8.j);
                                if (a3.h <= b2.a)
                                {
                                    PluginCore.cq.n.a("Find debuff choice (" + str + "): Test 6 passed", e8.j);
                                    goto Label_036B;
                                }
                            }
                        }
                        b2.b = a3.g;
                        b2.a = a3.h;
                        a.d  = num;
                        PluginCore.cq.n.a("Find debuff choice (" + str + "): Item set to be used, quality " + b2.a.ToString() + ".", e8.j);
                    }
                }
            }
Label_036B:
            PluginCore.cq.n.a("Find debuff choice (" + str + "): Item tests done.", e8.j);
            continue;
Label_0392:
            PluginCore.cq.n.a("Find debuff choice (" + str + "): Stop, wrong object type", e8.j);
            continue;
Label_03B9:
            ai.a("Warning: DbT ignoring item " + PluginCore.cq.aw.get_WorldFilter().get_Item(num).get_Name() + " because it cannot currently be wielded.");
            continue;
Label_03EA:
            PluginCore.cq.n.a("Find debuff choice (" + str + "): Stop, object invalid", e8.j);
        }
        bw.b b3 = new bw.b(bw.b.a.c);
        foreach (KeyValuePair <string, fz> pair in PluginCore.cq.l.h)
        {
            if (((fz)pair.Value) == fz.h)
            {
                bz bz = PluginCore.cq.x.d(pair.Key);
                if (bz == null)
                {
                    ai.a("Warning: DbT ignoring item " + pair.Key + " because it is not in the grenade database.");
                }
                else if (!fn.b(bz.b, bz.c, bz.d, bz.a))
                {
                    ai.a("Warning: DbT ignoring item " + bz.a + " because it cannot currently be wielded.");
                }
                else if (bz.e.RealFamily == A_0.RealFamily)
                {
                    bw.b b4 = new bw.b(bw.b.a.c)
                    {
                        b = bz.e,
                        a = bz.f
                    };
                    if (b4.a(b3) > 0)
                    {
                        MyList <int> list2 = dh.d(pair.Key);
                        if (list2.Count > 0)
                        {
                            int num2 = 0x7fffffff;
                            int num3 = 0;
                            foreach (int num4 in list2)
                            {
                                int num5 = PluginCore.cq.aw.get_WorldFilter().get_Item(num4).Values(0xd000006);
                                if (num5 < num2)
                                {
                                    num3 = num4;
                                    num2 = num5;
                                }
                            }
                            if (num3 != 0)
                            {
                                a.b = null;
                                a.c = "";
                                a.a = num3;
                                b3  = b4;
                            }
                        }
                        else
                        {
                            MyPair <int, int> pair2 = PluginCore.cq.y.a(pair.Key, 1);
                            if (pair2 != null)
                            {
                                a.b = pair2;
                                a.c = pair.Key;
                                a.a = 0;
                                b3  = b4;
                            }
                        }
                    }
                }
            }
        }
        a.e = b;
        if (a.e.a(b2) < 0)
        {
            a.e = b2;
        }
        if (a.e.a(b3) < 0)
        {
            a.e = b3;
        }
        this.e[A_0.Id] = a;
        return(a.e.b);
    }
示例#10
0
    private void a(string[] A_0)
    {
        y.b key;
        List <MyPair <string, bool> > list;
        bool   flag;
        string str;
        bool   flag2;

        if (A_0.Length == 3)
        {
            int num;
            if (A_0[0] != "fvote")
            {
                return;
            }
            if (!int.TryParse(A_0[1], out num))
            {
                return;
            }
            key  = null;
            list = null;
            foreach (KeyValuePair <y.b, List <MyPair <string, bool> > > pair in this.r)
            {
                if (pair.Key.e == num)
                {
                    key  = pair.Key;
                    list = pair.Value;
                    break;
                }
            }
            if (key != null)
            {
                flag = false;
                str  = CoreManager.get_Current().get_CharacterFilter().get_Name();
                if (string.Compare(A_0[2], "yes", true) == 0)
                {
                    flag = true;
                    goto Label_00FD;
                }
                if (string.Compare(A_0[2], "no", true) == 0)
                {
                    flag = false;
                    goto Label_00FD;
                }
                if (string.Compare(A_0[2], "abort", true) == 0)
                {
                    this.r.Remove(key);
                    PluginCore.cq.ah.b("/f [VT Fellow Manager] Vote " + key.ToString() + " canceled by fellow leader.  -v-");
                }
            }
        }
        return;

Label_00FD:
        flag2 = false;
        foreach (MyPair <string, bool> pair2 in list)
        {
            if (pair2.a == str)
            {
                flag2   = true;
                pair2.b = flag;
                break;
            }
        }
        if (!flag2)
        {
            MyPair <string, bool> item = new MyPair <string, bool> {
                a = str,
                b = flag
            };
            list.Add(item);
        }
        int num2 = 0;
        int num3 = 0;

        foreach (MyPair <string, bool> pair4 in list)
        {
            if (pair4.b)
            {
                num2++;
            }
            else
            {
                num3++;
            }
        }
        PluginCore.cq.ah.b("/f [VT Fellow Manager] Vote total for " + key.ToString() + ": " + num2.ToString() + "/" + num3.ToString() + "  -v-");
    }
示例#11
0
    private void a(object A_0, ChatTextInterceptEventArgs A_1)
    {
        try
        {
            string str;
            string str2;
            string str10;
            string str11;
            y.b    b;
            int    e;
            if ((PluginCore.cq.n.b && er.j("AutoFellowManagement")) && ((A_1.get_Color() == 3) && this.f.c()))
            {
                Match match = this.x.Match(A_1.get_Text());
                if (match.Success)
                {
                    str  = match.Groups["name"].Value;
                    str2 = match.Groups["msg"].Value;
                    if (string.Compare(str2, "xp", true) == 0)
                    {
                        if (!this.a(str))
                        {
                            foreach (KeyValuePair <int, ar.a> pair in this.f.a)
                            {
                                if (pair.Value.b == str)
                                {
                                    PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] You are already in the fellowship.  -v-");
                                    return;
                                }
                            }
                            if (this.j.Contains(str.ToLowerInvariant()))
                            {
                                PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Sorry, but you have been banned from this fellowship.  -v-");
                            }
                            else if (!this.l && !this.f.d())
                            {
                                string str3 = "????";
                                if (this.f.a.ContainsKey(this.f.b()))
                                {
                                    str3 = this.f.a[this.f.b()].b;
                                }
                                PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] I'm sorry, but the fellowship is closed and I am not the leader. The leader is currently: " + str3 + "  -v-");
                            }
                            else if (this.l)
                            {
                                if (this.k.Contains(str))
                                {
                                    if (this.m)
                                    {
                                        if (this.u.ContainsKey(str))
                                        {
                                            if (!this.p.Contains(str))
                                            {
                                                this.p.Add(str);
                                            }
                                            PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Please wait nearby. I will try to recruit you in a moment.  -v-");
                                        }
                                        else
                                        {
                                            int num = this.k.IndexOf(str) + 1;
                                            PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] You are already number " + num.ToString() + " of " + this.k.Count.ToString() + " on the waiting list.  -v-");
                                        }
                                    }
                                    else
                                    {
                                        PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Please wait nearby. I will try to recruit you in a moment.  -v-");
                                    }
                                }
                                else if (this.m)
                                {
                                    this.k.Add(str);
                                    PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] The fellow is full, and I am the leader. I am adding you to the waiting list at position " + this.k.Count.ToString() + "  -v-");
                                }
                                else
                                {
                                    this.k.Add(str);
                                    PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] I will recruit you in a moment. Please stand close to me.  -v-");
                                }
                            }
                            else if ((!this.l && this.f.d()) && !this.a())
                            {
                                if (!this.k.Contains(str))
                                {
                                    this.k.Add(str);
                                }
                                PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Please wait nearby. I will try to recruit you in a moment.  -v-");
                            }
                            else if ((!this.l && this.f.d()) && this.a())
                            {
                                string str4 = "????";
                                if (this.f.a.ContainsKey(this.f.b()))
                                {
                                    str4 = this.f.a[this.f.b()].b;
                                }
                                PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] I'm sorry, but the fellowship is full. The leader is currently: " + str4 + "  -v-");
                            }
                        }
                    }
                    else if (((string.Compare(str2, "line", true) == 0) || (string.Compare(str2, "list", true) == 0)) || (string.Compare(str2, "status", true) == 0))
                    {
                        if (!this.a(str))
                        {
                            if (this.l)
                            {
                                if (!this.m)
                                {
                                    string[] strArray7 = new string[] { "/t ", str, ", [VT Fellow Manager] There is no waiting list. The fellowship has ", (this.f.a.Count + 1).ToString(), " members.  -v-" };
                                    PluginCore.cq.ah.b(string.Concat(strArray7));
                                }
                                else if (this.k.Contains(str))
                                {
                                    int num2 = this.k.IndexOf(str) + 1;
                                    PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] You are number " + num2.ToString() + " of " + this.k.Count.ToString() + " on the waiting list.  -v-");
                                }
                                else
                                {
                                    PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] The waiting list contains " + this.k.Count.ToString() + " players. You are not on it.  -v-");
                                }
                            }
                            else
                            {
                                string str5;
                                if (this.f.d())
                                {
                                    str5 = "open";
                                }
                                else
                                {
                                    str5 = "closed";
                                }
                                string str6 = "????";
                                if (this.f.a.ContainsKey(this.f.b()))
                                {
                                    str6 = this.f.a[this.f.b()].b;
                                }
                                PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] The leader is currently: " + str6 + ". The fellowship is " + str5 + ".  -v-");
                            }
                        }
                    }
                    else if (string.Compare(str2, "remove", true) == 0)
                    {
                        if (!this.a(str))
                        {
                            string item = str;
                            if (this.k.Contains(item))
                            {
                                this.k.Remove(item);
                            }
                            if (this.p.Contains(item))
                            {
                                this.p.Remove(item);
                            }
                            if (this.u.ContainsKey(item))
                            {
                                this.u.Remove(item);
                            }
                            this.b();
                            PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] You have been removed from the list.  -v-");
                        }
                    }
                    else if (string.Compare(str2, "leader", true) == 0)
                    {
                        if (!this.a(str))
                        {
                            string str8;
                            if (this.f.d())
                            {
                                str8 = "open";
                            }
                            else
                            {
                                str8 = "closed";
                            }
                            if (this.l)
                            {
                                PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] I am the fellowship leader. The fellowship is " + str8 + ".  -v-");
                            }
                            else
                            {
                                string str9 = "????";
                                if (this.f.a.ContainsKey(this.f.b()))
                                {
                                    str9 = this.f.a[this.f.b()].b;
                                }
                                PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] The leader is currently: " + str9 + ". The fellowship is " + str8 + ".  -v-");
                            }
                        }
                    }
                    else if (string.Compare(str2, "help", true) == 0)
                    {
                        if (!this.a(str))
                        {
                            PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Available commands: xp, line, remove, leader, startvote, vote, location, help  -v-");
                        }
                    }
                    else if (string.Compare(str2, "help startvote", true) == 0)
                    {
                        if (!this.a(str))
                        {
                            PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Usage: startvote [votetype] [parameter]. Possible vote types: kick, ban, giveleader, setopen.  -v-");
                        }
                    }
                    else if (string.Compare(str2, "help vote", true) == 0)
                    {
                        if (!this.a(str))
                        {
                            PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Usage: vote [vote id] [yes/no]  -v-");
                        }
                    }
                    else
                    {
                        if (!str2.StartsWith("startvote "))
                        {
                            goto Label_1027;
                        }
                        if ((!this.a(str) && this.b(str)) && !this.j.Contains(str.ToLowerInvariant()))
                        {
                            if (this.q.ContainsKey(str) && (this.q[str] > DateTimeOffset.Now))
                            {
                                string[] strArray13 = new string[] { "/t ", str, ", [VT Fellow Manager] You have initiated a vote too recently (wait another ", (this.q[str] - DateTimeOffset.Now).ToString(), ").  -v-" };
                                PluginCore.cq.ah.b(string.Concat(strArray13));
                            }
                            else
                            {
                                string[] strArray = str2.Split(new char[] { ' ' });
                                if (strArray.Length < 3)
                                {
                                    PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Not enough parameters to startvote command. Tell me 'help startvote' for more information.  -v-");
                                }
                                else
                                {
                                    str10 = strArray[1];
                                    StringBuilder builder = new StringBuilder();
                                    for (int i = 2; i < strArray.Length; i++)
                                    {
                                        if (i > 2)
                                        {
                                            builder.Append(" ");
                                        }
                                        builder.Append(strArray[i]);
                                    }
                                    str11 = builder.ToString();
                                    b     = new y.b {
                                        b = str11.ToLowerInvariant()
                                    };
                                    if (string.Compare(str10, "kick", true) == 0)
                                    {
                                        if (!this.b(str11))
                                        {
                                            PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Cannot vote to kick " + str11 + ", that player is not in the fellow.  -v-");
                                            return;
                                        }
                                        b.a = y.a.a;
                                        goto Label_0CE0;
                                    }
                                    if (string.Compare(str10, "ban", true) == 0)
                                    {
                                        if (!this.b(str11))
                                        {
                                            PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Cannot vote to ban " + str11 + ", that player is not in the fellow.  -v-");
                                            return;
                                        }
                                        b.a = y.a.b;
                                        goto Label_0CE0;
                                    }
                                    if (string.Compare(str10, "giveleader", true) == 0)
                                    {
                                        if (!this.b(str11))
                                        {
                                            PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Cannot vote to give leader to " + str11 + ", that player is not in the fellow.  -v-");
                                            return;
                                        }
                                        b.a = y.a.c;
                                        goto Label_0CE0;
                                    }
                                    if (string.Compare(str10, "setopen", true) == 0)
                                    {
                                        if ((str11 != "true") && (str11 != "false"))
                                        {
                                            PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] A setopen vote call must be followed by 'true' or 'false'.  -v-");
                                            return;
                                        }
                                        b.a = y.a.d;
                                        goto Label_0CE0;
                                    }
                                    PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Unknown vote type. Tell me 'help startvote' for more information.  -v-");
                                }
                            }
                        }
                    }
                }
            }
            return;

Label_0CE0:
            e = 0;
            foreach (KeyValuePair <y.b, List <MyPair <string, bool> > > pair2 in this.r)
            {
                if (pair2.Key.a(b) == 0)
                {
                    e = pair2.Key.e;
                    break;
                }
            }
            if (e != 0)
            {
                PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] An identical vote is already in progress! (Vote ID " + e.ToString() + ")  -v-");
            }
            else
            {
                b.c = DateTimeOffset.Now + TimeSpan.FromMinutes(2.0);
                string[] strArray3 = new string[] { "/f [VT Fellow Manager] ", str, " has called a new vote: ", str10.ToLowerInvariant(), " ", str11, "! To vote, either tell me 'vote ", b.e.ToString(), " yes' or 'vote ", b.e.ToString(), " no'. You have ", 2.0.ToString(), " minutes.  -v-" };
                PluginCore.cq.ah.b(string.Concat(strArray3));
                this.r.Add(b, new List <MyPair <string, bool> >());
                MyPair <string, bool> pair3 = new MyPair <string, bool> {
                    a = str,
                    b = true
                };
                this.r[b].Add(pair3);
                this.q[str] = DateTimeOffset.Now + TimeSpan.FromMinutes(4.0);
                PluginCore.cq.ah.b("/f [VT Fellow Manager] Vote total for '" + str10.ToLowerInvariant() + " " + str11 + "' (ID " + b.e.ToString() + "): 1/0  -v-");
                PluginCore.e("Vote called by " + str + ": " + b.ToString() + ". [" + a.a("Vote Yes", new string[] { "fvote", b.e.ToString(), "yes" }) + "] [" + a.a("Vote No", new string[] { "fvote", b.e.ToString(), "no" }) + "] [" + a.a("Abort Vote", new string[] { "fvote", b.e.ToString(), "abort" }) + "]");
            }
            return;

Label_1027:
            if (str2.StartsWith("vote "))
            {
                if ((!this.a(str) && this.b(str)) && !this.j.Contains(str.ToLowerInvariant()))
                {
                    int      num5;
                    string[] strArray2 = str2.Split(new char[] { ' ' });
                    if ((strArray2.Length != 3) || !int.TryParse(strArray2[1], out num5))
                    {
                        PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Invalid vote command. Votes should look like: vote idnumber yes, or: vote idnumber no  -v-");
                        return;
                    }
                    bool flag = false;
                    if (string.Compare(strArray2[2], "yes", true) == 0)
                    {
                        flag = true;
                    }
                    else if (string.Compare(strArray2[2], "no", true) == 0)
                    {
                        flag = false;
                    }
                    else
                    {
                        PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Invalid vote command. Votes should look like: vote idnumber yes, or: vote idnumber no  -v-");
                        return;
                    }
                    y.b key = null;
                    List <MyPair <string, bool> > list = null;
                    foreach (KeyValuePair <y.b, List <MyPair <string, bool> > > pair4 in this.r)
                    {
                        if (pair4.Key.e == num5)
                        {
                            key  = pair4.Key;
                            list = pair4.Value;
                            break;
                        }
                    }
                    if (key == null)
                    {
                        PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Invalid vote ID number. Votes should look like: vote idnumber yes, or: vote idnumber no  -v-");
                        return;
                    }
                    bool flag2 = false;
                    foreach (MyPair <string, bool> pair5 in list)
                    {
                        if (pair5.a == str)
                        {
                            flag2   = true;
                            pair5.b = flag;
                            break;
                        }
                    }
                    if (!flag2)
                    {
                        MyPair <string, bool> pair6 = new MyPair <string, bool> {
                            a = str,
                            b = flag
                        };
                        list.Add(pair6);
                    }
                    int num6 = 0;
                    int num7 = 0;
                    foreach (MyPair <string, bool> pair7 in list)
                    {
                        if (pair7.b)
                        {
                            num6++;
                        }
                        else
                        {
                            num7++;
                        }
                    }
                    PluginCore.cq.ah.b("/f [VT Fellow Manager] Vote total for " + key.ToString() + ": " + num6.ToString() + "/" + num7.ToString() + "  -v-");
                }
            }
            else
            {
                if ((string.Compare(str2, "location", true) != 0) || this.a(str))
                {
                    return;
                }
                bool flag3 = false;
                foreach (KeyValuePair <int, ar.a> pair8 in this.f.a)
                {
                    if (pair8.Value.b == str)
                    {
                        flag3 = true;
                        break;
                    }
                }
                if (flag3)
                {
                    PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] I am currently located in landcell: " + PluginCore.cq.p.d(PluginCore.cg).w.d().ToString("X8") + "  -v-");
                }
                else
                {
                    PluginCore.cq.ah.b("/t " + str + ", [VT Fellow Manager] Sorry, I can only send my location to members of the fellowship.  -v-");
                }
            }
        }
        catch (Exception exception)
        {
            ad.a(exception);
        }
    }
示例#12
0
    public static bool a(a1 A_0, eDamageElement A_1, int A_2, ePrismaticDamageBehavior A_3)
    {
        int num;
        SkillInfo info;
        b = 0;
        c = 0;
        a = false;
        if (PluginCore.cq.x.e())
        {
            num = 0;
            switch (A_0)
            {
                case a1.e:
                    num = 0x2f;
                    goto Label_0057;

                case a1.f:
                    num = 0x2f;
                    goto Label_0057;

                case a1.g:
                    num = 0x2f;
                    goto Label_0057;
            }
            b();
        }
        return false;
    Label_0057:
        info = null;
        eTrainingType type = 1;
        int num2 = 0;
        try
        {
            info = PluginCore.cq.aw.get_CharacterFilter().get_Underlying().get_Skill((eSkillID) num);
            type = info.get_Training();
            num2 = info.get_Base();
        }
        finally
        {
            if (info != null)
            {
                Marshal.ReleaseComObject(info);
            }
        }
        string str = "";
        if ((PluginCore.cq.av.g() != 0) && (PluginCore.cq.aw.get_WorldFilter().get_Item(PluginCore.cq.av.g()).Values(0xd000006, 0) > A_2))
        {
            str = PluginCore.cq.aw.get_WorldFilter().get_Item(PluginCore.cq.av.g()).get_Name();
        }
        int num3 = er.e("UseSpecialAmmo");
        int num4 = -2147483648;
        bool flag = true;
        foreach (v v in PluginCore.cq.x.c["AmmunitionOptions"].d())
        {
            eDamageElement prismatic = (eDamageElement) k.e(v.a("Element"));
            if (prismatic == eDamageElement.PrismaticDatabaseEntryOld)
            {
                prismatic = eDamageElement.Prismatic;
            }
            if (k.e(v.a("LauncherType")) == A_0)
            {
                int num5 = k.e(v.a("Quality"));
                if ((A_3 == ePrismaticDamageBehavior.ForcePrismatic) && (prismatic != eDamageElement.Prismatic))
                {
                    num5 -= 0x3e8;
                }
                if (prismatic != A_1)
                {
                    if (prismatic != eDamageElement.Prismatic)
                    {
                        continue;
                    }
                    bool flag2 = true;
                    switch (A_3)
                    {
                        case ePrismaticDamageBehavior.Any:
                            flag2 = true;
                            break;

                        case ePrismaticDamageBehavior.NoPrismatic:
                            flag2 = false;
                            break;

                        case ePrismaticDamageBehavior.ForcePrismatic:
                            flag2 = true;
                            break;
                    }
                    if (!flag2)
                    {
                        num5 -= 0x3e8;
                    }
                }
                if (num5 >= num4)
                {
                    string str2 = k.b(v.a("AmmoName"));
                    int num6 = k.e(v.a("WieldReq"));
                    if ((num6 <= 0) || (((type != 1) && (type != null)) && (num2 >= num6)))
                    {
                        int num7 = k.e(v.a("WieldReq2Skill"));
                        int num8 = k.e(v.a("WieldReq2Value"));
                        if ((num7 != 0) && (num8 != 0))
                        {
                            SkillType type2 = (SkillType) (num7 + 50);
                            if ((PluginCore.cq.ax.get_Actions().get_SkillTrainLevel().get_Item(type2) == 0) || (PluginCore.cq.ax.get_Actions().get_Skill().get_Item(type2) < num8))
                            {
                                continue;
                            }
                        }
                        int num9 = k.e(v.a("Special"));
                        if ((num9 == 0) || ((num9 & num3) != 0))
                        {
                            if (str == str2)
                            {
                                b = 1;
                                flag = true;
                                num4 = num5;
                            }
                            else
                            {
                                int num10 = A_2;
                                if (num10 < 1)
                                {
                                    num10 = 1;
                                }
                                if (dh.a(str2) >= num10)
                                {
                                    num4 = num5;
                                    a = false;
                                    flag = false;
                                    b = dh.c(str2);
                                }
                                else
                                {
                                    MyPair<int, int> pair = PluginCore.cq.y.a(str2, num10);
                                    if (pair != null)
                                    {
                                        num4 = num5;
                                        flag = false;
                                        a = true;
                                        d = str2;
                                        b = pair.a;
                                        c = pair.b;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return !flag;
    }
示例#13
0
文件: Main.cs 项目: KhanY-u/lab_06
    public static void Main()
    {
        MyPair <String, int> pair = new MyPair <String, int>("Andres", 13);

        Console.WriteLine(pair.toString());
    }