public void RegisterFrequency( AttackType type, Mobile mob )
        {
            if ( !m_FrequencyTable.ContainsKey( mob ) )
            {
                if ( m_FrequencyTable.Count >= 20 ) // wipe if too big
                    m_FrequencyTable = new Dictionary< Mobile, ACEntry >();

                m_FrequencyTable[mob] = new ACEntry();
                m_FrequencyTable[mob].Weapon = mob.Weapon as Item;
            }
            if ( mob.Weapon != m_FrequencyTable[mob].Weapon )
            {
                m_FrequencyTable[mob].Weapon = mob.Weapon as Item;
                m_FrequencyTable[mob].Swing = m_FrequencyTable[mob].Thrust = m_FrequencyTable[mob].Overhead = 0;
            }

            if ( type == AttackType.Swing )
                m_FrequencyTable[mob].Swing++;
            else if ( type == AttackType.Thrust )
                m_FrequencyTable[mob].Thrust++;
            else if ( type == AttackType.Overhead )
                m_FrequencyTable[mob].Overhead++;
        }
Example #2
0
        public void LoadAutoComplete(string filename)
        {
            g.LogDebug("CAUTOCOMPLETE::LoadAutoComplete: Enter - " + filename);

            g.LogDebug("CAUTOCOMPLETE::LoadAutoComplete: Opening file");
            StreamReader reader = new StreamReader(filename);


            string linedata;

            g.LogDebug("CAUTOCOMPLETE::LoadAutoComplete: Loading function listing");
            while ((linedata = reader.ReadLine()) != null)
            {
                // Skip comments and newlines
                if (linedata == "")
                {
                    continue;
                }
                else if (linedata.StartsWith("#"))
                {
                    continue;
                }

                // Split the autocomplete line data
                string [] entry = linedata.Split('|');

                // Skip bad lines
                if (entry.Length != 4)
                {
                    continue;
                }

                //IParameterInfo p;
                //IListMember m;
                ACEntry acentry;

                // Check if an existing entry already exists:
                if (!_ht.ContainsKey(entry[0].ToLower()))
                {
                    // Create a new entry:
                    //p = new ParameterInfo();
                    //m = p.AddMember();
                    acentry = new ACEntry();
                    acentry.FormattedParameters  = new ArrayList();
                    acentry.FormattedDescription = new ArrayList();
                    acentry.FormattedName        = new ArrayList();

                    acentry.UnformattedDescription = new ArrayList();
                    acentry.UnformattedName        = new ArrayList();
                    acentry.UnformattedParameters  = new ArrayList();

                    // Add it to the hashtable
                    _ht.Add(entry[0].ToLower(), acentry);
                }
                else
                {
                    // Take previous entry and create a new member
                    acentry = (ACEntry)_ht[entry[0].ToLower()];
                    //m = p.AddMember();
                }

                acentry.FormattedName.Add("<b><u>" + entry[2] + "</u> " + entry[0] + "</b>");
                acentry.UnformattedName.Add(entry[0]);

                // Split the parameters, if there are any
                if (entry[1].Length > 0)
                {
                    string [] paramlist = entry[1].Split(',');
                    //m.Params = new ParamInfo[paramlist.Length];

                    string s_paramlist  = "";
                    string s_uparamlist = "";
                    // Enumerate through each parameter and add it to the list
                    for (int i = 0; i < paramlist.Length; i++)
                    {
                        // Split the current parameter entry at the space:
                        string[] paramentry = paramlist[i].Split(' ');

                        // Skip bad parameter entries
                        if (paramentry.Length != 2)
                        {
                            continue;
                        }

                        //ParamInfo pentry = new ParamInfo();
                        //pentry.DataType = paramentry[0];
                        //pentry.Name = paramentry[1];
                        //pentry.Qualifier = "System.";

                        //m.Params.Add(pentry);
                        s_paramlist  += "<u>" + paramentry[0] + "</u> <i>" + paramentry[1] + "</i>, ";
                        s_uparamlist += paramentry[0] + " " + paramentry[1] + ", ";
                    }

                    s_paramlist  = s_paramlist.Substring(0, s_paramlist.Length - 2);
                    s_uparamlist = s_uparamlist.Substring(0, s_uparamlist.Length - 2);
                    acentry.FormattedParameters.Add(s_paramlist);
                    acentry.UnformattedParameters.Add(s_uparamlist);
                }
                else
                {
                    // Just add a blank parameter listing
                    acentry.FormattedParameters.Add("<i>void</i>");
                    acentry.UnformattedParameters.Add("void");
                }

                acentry.FormattedDescription.Add(entry[3]);
                acentry.UnformattedDescription.Add(entry[3]);
                //m.DataType = entry[2];		// Return type
                //m.Description = entry[3];	// Description
            }             // End while

            // Close auto-complete file
            g.LogDebug("CAUTOCOMPLETE::LoadAutoComplete: Closing file");
            reader.Close();
        }         // End function
Example #3
0
        public void LoadAutoComplete(string filename)
        {
            g.LogDebug("CAUTOCOMPLETE::LoadAutoComplete: Enter - " + filename);

            g.LogDebug("CAUTOCOMPLETE::LoadAutoComplete: Opening file");
            StreamReader reader = new StreamReader(filename);

            string linedata;
            g.LogDebug("CAUTOCOMPLETE::LoadAutoComplete: Loading function listing");
            while((linedata = reader.ReadLine()) != null) {
                // Skip comments and newlines
                if (linedata == "")
                    continue;
                else if (linedata.StartsWith("#"))
                    continue;

                // Split the autocomplete line data
                string [] entry = linedata.Split('|');

                // Skip bad lines
                if (entry.Length != 4)
                    continue;

                //IParameterInfo p;
                //IListMember m;
                ACEntry acentry;

                // Check if an existing entry already exists:
                if (!_ht.ContainsKey(entry[0].ToLower())) {
                    // Create a new entry:
                    //p = new ParameterInfo();
                    //m = p.AddMember();
                    acentry = new ACEntry();
                    acentry.FormattedParameters = new ArrayList();
                    acentry.FormattedDescription = new ArrayList();
                    acentry.FormattedName = new ArrayList();

                    acentry.UnformattedDescription = new ArrayList();
                    acentry.UnformattedName = new ArrayList();
                    acentry.UnformattedParameters = new ArrayList();

                    // Add it to the hashtable
                    _ht.Add(entry[0].ToLower(), acentry);
                } else {
                    // Take previous entry and create a new member
                    acentry = (ACEntry)_ht[entry[0].ToLower()];
                    //m = p.AddMember();
                }

                acentry.FormattedName.Add("<b><u>" + entry[2] + "</u> " + entry[0] + "</b>");
                acentry.UnformattedName.Add(entry[0]);

                // Split the parameters, if there are any
                if (entry[1].Length > 0) {
                    string [] paramlist = entry[1].Split(',');
                    //m.Params = new ParamInfo[paramlist.Length];

                    string s_paramlist = "";
                    string s_uparamlist = "";
                    // Enumerate through each parameter and add it to the list
                    for(int i = 0; i < paramlist.Length; i++) {
                        // Split the current parameter entry at the space:
                        string[] paramentry = paramlist[i].Split(' ');

                        // Skip bad parameter entries
                        if (paramentry.Length != 2)
                            continue;

                        //ParamInfo pentry = new ParamInfo();
                        //pentry.DataType = paramentry[0];
                        //pentry.Name = paramentry[1];
                        //pentry.Qualifier = "System.";

                        //m.Params.Add(pentry);
                        s_paramlist += "<u>" + paramentry[0] + "</u> <i>" + paramentry[1] + "</i>, ";
                        s_uparamlist += paramentry[0] + " " + paramentry[1] + ", ";
                    }

                    s_paramlist = s_paramlist.Substring(0, s_paramlist.Length - 2);
                    s_uparamlist = s_uparamlist.Substring(0, s_uparamlist.Length - 2);
                    acentry.FormattedParameters.Add(s_paramlist);
                    acentry.UnformattedParameters.Add(s_uparamlist);
                } else {
                    // Just add a blank parameter listing
                    acentry.FormattedParameters.Add("<i>void</i>");
                    acentry.UnformattedParameters.Add("void");
                }

                acentry.FormattedDescription.Add(entry[3]);
                acentry.UnformattedDescription.Add(entry[3]);
                //m.DataType = entry[2];		// Return type
                //m.Description = entry[3];	// Description

            } // End while

            // Close auto-complete file
            g.LogDebug("CAUTOCOMPLETE::LoadAutoComplete: Closing file");
            reader.Close();
        }