Beispiel #1
0
        public void Load(BinaryReader f)
        {
            id   = f.ReadInt32();
            name = f.ReadString();
            RaceId race_id = (RaceId)f.ReadInt32();

            race = Race.Get(race_id);
            ClassId class_id = (ClassId)f.ReadInt32();

            clas             = Class.Get(class_id);
            level            = f.ReadInt32();
            exp              = f.ReadInt32();
            exp_need         = 100 * level;
            str              = f.ReadInt32();
            dex              = f.ReadInt32();
            end              = f.ReadInt32();
            hp               = f.ReadInt32();
            hpmax            = CalculateMaxHp();
            weapon           = f.ReadInt32();
            armor            = f.ReadInt32();
            bow              = f.ReadInt32();
            gold             = f.ReadInt32();
            potions          = f.ReadInt32();
            age              = f.ReadInt32();
            kills            = f.ReadInt32();
            dungeon_level    = f.ReadInt32();
            lowest_level     = f.ReadInt32();
            target_level     = f.ReadInt32();
            know_down_stairs = f.ReadBoolean();
            immortal         = f.ReadBoolean();
        }
Beispiel #2
0
        /// <summary>Initializes the editor.</summary>
        /// <param name="filepath">The path to the file.</param>
        public DvrmsMetadataEditor(string filepath) : base()
        {
            IFileSourceFilter sourceFilter = (IFileSourceFilter)ClassId.CoCreateInstance(ClassId.RecordingAttributes);

            sourceFilter.Load(filepath, null);
            _editor = (IStreamBufferRecordingAttribute)sourceFilter;
        }
Beispiel #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (ClassId.Length != 0)
            {
                hash ^= ClassId.GetHashCode();
            }
            if (Protocol != global::PKIo.PassProtocol.DoNotUse)
            {
                hash ^= Protocol.GetHashCode();
            }
            if (personDetails_ != null)
            {
                hash ^= PersonDetails.GetHashCode();
            }
            if (metadata_ != null)
            {
                hash ^= Metadata.GetHashCode();
            }
            hash ^= RecordData.GetHashCode();
            if (ExternalId.Length != 0)
            {
                hash ^= ExternalId.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #4
0
        /// <summary>
        /// Gets the modified value from the table ClassMeleeCritChance from the correct index.
        /// Returns the modified value matching the format "XX stat for 1% chance"
        /// </summary>
        /// <param name="level"></param>
        /// <param name="id"></param>
        /// <returns>The modified value matching the format "XX rating for 1% chance"</returns>
        public static float GetClassMeleeCritChanceValue(int level, ClassId id)
        {
            var value = GetValuePerRating(ClassMeleeCritChance, level, id);

            return(ModifyValue(value));
            //return value;
        }
Beispiel #5
0
        /// <summary>
        /// Writes data directly to the state of the specified class.
        /// </summary>
        /// <param name="classId">ID of the class to write the data into</param>
        /// <param name="offset">State offset in bytes</param>
        /// <param name="value">Value to be written</param>
        public void Write(ClassId classId, int offset, int value)
        {
            switch (classId)
            {
            case ClassId.Threed:
                _3dClass.Write(offset, value);
                break;

            case ClassId.Compute:
                _computeClass.Write(offset, value);
                break;

            case ClassId.InlineToMemory:
                _i2mClass.Write(offset, value);
                break;

            case ClassId.Twod:
                _2dClass.Write(offset, value);
                break;

            case ClassId.Dma:
                _dmaClass.Write(offset, value);
                break;

            case ClassId.GPFifo:
                _fifoClass.Write(offset, value);
                break;
            }
        }
Beispiel #6
0
        private void Step(int value)
        {
            if (_mask != 0)
            {
                int lbs = BitOperations.TrailingZeroCount(_mask);

                _mask &= ~(1 << lbs);

                DeviceWrite(_offset + lbs, value);

                return;
            }
            else if (_count != 0)
            {
                _count--;

                DeviceWrite(_offset, value);

                if (_incrementing)
                {
                    _offset++;
                }

                return;
            }

            OpCode opCode = (OpCode)((value >> 28) & 0xf);

            switch (opCode)
            {
            case OpCode.SetClass:
                _mask = value & 0x3f;
                ClassId classId = (ClassId)((value >> 6) & 0x3ff);
                _offset = (value >> 16) & 0xfff;
                _device = _devices.GetDevice(classId);
                break;

            case OpCode.Incr:
            case OpCode.NonIncr:
                _count        = value & 0xffff;
                _offset       = (value >> 16) & 0xfff;
                _incrementing = opCode == OpCode.Incr;
                break;

            case OpCode.Mask:
                _mask   = value & 0xffff;
                _offset = (value >> 16) & 0xfff;
                break;

            case OpCode.Imm:
                int data = value & 0xfff;
                _offset = (value >> 16) & 0xfff;
                DeviceWrite(_offset, data);
                break;

            default:
                Logger.Error?.Print(LogClass.Host1x, $"Unsupported opcode \"{opCode}\".");
                break;
            }
        }
Beispiel #7
0
        public ClassTemplate GetType(ClassId type)
        {
            ClassTemplate tObject;

            types.TryGetValue(type, out tObject);
            return(tObject);
        }
Beispiel #8
0
        /// <summary>
        /// Returns a list of all SpellLines that are affected by the given spell family set (very long bit field)
        /// </summary>
        public static HashSet <SpellLine> GetAffectedSpellLines(ClassId clss, uint[] mask)
        {
            var lines    = SpellLines.GetLines(clss);
            var affected = new HashSet <SpellLine>();

            if (lines != null)
            {
                foreach (var line in lines)
                {
                    foreach (var spell in line)
                    {
                        if (spell.MatchesMask(mask))
                        {
                            affected.Add(line);
                            break;
                        }
                    }
                }
                //foreach (var spell in ById)
                //{
                //    if (spell != null && spell.ClassId == clss && spell.MatchesMask(mask))
                //    {
                //        if (spell.Line != null)
                //        {
                //            affected.Add(line);
                //        }
                //        break;
                //    }
                //}
            }
            return(affected);
        }
Beispiel #9
0
 public SyncptIncr(uint id, ClassId classId, uint syncptId, bool done = false)
 {
     Id       = id;
     ClassId  = classId;
     SyncptId = syncptId;
     Done     = done;
 }
Beispiel #10
0
 public Location(TypeTag typeTag, ClassId @class, MethodId method, ulong index)
 {
     TypeTag = typeTag;
     Class = @class;
     Method = method;
     Index = index;
 }
Beispiel #11
0
 public SubStruct_1A35E this[ClassId i]
 {
     get
     {
         return(field_00[(int)i]);
     }
 }
Beispiel #12
0
        /// <summary>
        /// Tests all PeriodicAppointment fields match the expected values.
        /// </summary>
        internal static void AssertAreEqual(PeriodicAppointmentBuilder expected, PeriodicAppointment actual, string message)
        {
            var messagePrefix = String.Format("{0} Label:<{1}>.", message, expected.GetLabel());

            Assert.AreEqual(expected.GetDetails(), actual.GetDetails(), String.Concat(messagePrefix, " details"));
            Assert.AreEqual(expected.GetDurationMinutes(), actual.GetDurationMinutes(), String.Concat(messagePrefix, " durationMinutes"));
            Assert.AreEqual(true, actual.IsRepeating(), String.Concat(messagePrefix, " IsRepeating"));
            Assert.AreEqual(expected.GetLabel(), actual.GetLabel(), String.Concat(messagePrefix, " label"));

            Assert.AreEqual(ToString(expected.GetOccurs()), ToString(actual.GetStartTime()), String.Concat(messagePrefix, " startTime"));
            Assert.AreNotSame(actual.GetStartTime(), actual.GetStartTime(), String.Concat(messagePrefix, " startTime deep copy"));

            var expectedClassId = new ClassId("PeriodicAppointment");

            Assert.AreEqual(0, actual.GetClassId().CompareTo(expectedClassId), String.Concat(messagePrefix, " classId"));

            //Test Contact relations
            var relation        = actual.GetContacts();
            var contactBuilders = expected.GetContactBuilders();

            Assert.AreEqual(contactBuilders.Length, relation.GetChildCount(), String.Concat(messagePrefix, " contacts.Count"));

            for (int i = 0; i < contactBuilders.Length; i++)
            {
                Helper.AssertAreEqual(contactBuilders[i], relation.GetChild(i), String.Concat(messagePrefix, " contacts[", i.ToString(), "].Data"));
            }
        }
Beispiel #13
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (ClassId != 0)
        {
            hash ^= ClassId.GetHashCode();
        }
        if (Score != 0F)
        {
            hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Score);
        }
        if (bbox_ != null)
        {
            hash ^= Bbox.GetHashCode();
        }
        if (segm_ != null)
        {
            hash ^= Segm.GetHashCode();
        }
        if (florplanpoint_ != null)
        {
            hash ^= Florplanpoint.GetHashCode();
        }
        if (Features.Length != 0)
        {
            hash ^= Features.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
Beispiel #14
0
        private void FatchTest()
        {
            try
            {
                EWA_UploadResult objEWA = new EWA_UploadResult();
                BL_UploadResult  objBL  = new BL_UploadResult();
                objEWA.OrgId      = Session["OrgId"].ToString();
                objEWA.CourseId   = CourseId.ToString();
                objEWA.BranchId   = BranchId.ToString();
                objEWA.ClassId    = ClassId.ToString();
                objEWA.SemesterId = ddlSemester.SelectedValue.ToString();

                DataSet ds = objBL.FatchTest_BL(objEWA);

                ddlTest.DataSource = ds;
                if (ds.Tables[0].Rows.Count != 0)
                {
                    ddlTest.DataTextField  = "TestName";
                    ddlTest.DataValueField = "TestId";
                    ddlTest.DataBind();
                }
                else
                {
                    ddlTest.Items.Clear();
                }

                ddlTest.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "0"));
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Beispiel #15
0
        private void BindSemester()
        {
            try
            {
                EWA_Common objEWA = new EWA_Common();
                BL_Common  objBL  = new BL_Common();
                //objEWA.OrgId = Session["OrgId"].ToString();
                //objEWA.CourseId = ddlCourse.SelectedValue.ToString();
                //objEWA.BranchId = ddlBranch.SelectedValue.ToString();
                objEWA.ClassId = ClassId.ToString();;
                DataSet ds = objBL.BindSemester_BL(objEWA);

                ddlSemester.DataSource = ds;
                if (ds.Tables[0].Rows.Count != 0)
                {
                    ddlSemester.DataTextField  = "SemesterName";
                    ddlSemester.DataValueField = "SemesterId";
                    ddlSemester.DataBind();
                }
                else
                {
                    ddlSemester.Items.Clear();
                }

                ddlSemester.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "0"));
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
 public override int GetHashCode()
 {
     unchecked
     {
         return((ClassId.GetHashCode() * 397) ^ ObjectId.GetHashCode());
     }
 }
Beispiel #17
0
        public static async Task <ObservableCollection <AdminMessage> > GetMessageData(string uri, int Id)
        {
            var client = new HttpClient();

            ObservableCollection <AdminMessage> responseModel = null;

            var model = new ClassId
            {
                id = Id
            };

            var json = JsonConvert.SerializeObject(model);

            HttpContent httpContent = new StringContent(json);

            httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            var response = await client.PostAsync(
                uri, httpContent);

            if (response.IsSuccessStatusCode)
            {
                string content = await response.Content.ReadAsStringAsync();

                Console.WriteLine(content);

                responseModel = JsonConvert.DeserializeObject <ObservableCollection <AdminMessage> >(content);

                Console.WriteLine(responseModel);
                Console.WriteLine(Application.Current.Properties["id"]);
            }

            return(responseModel);
        }
Beispiel #18
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (GroupId.Length != 0)
            {
                hash ^= GroupId.GetHashCode();
            }
            hash ^= objectIds_.GetHashCode();
            if (ClassId.Length != 0)
            {
                hash ^= ClassId.GetHashCode();
            }
            if (Criteria.Length != 0)
            {
                hash ^= Criteria.GetHashCode();
            }
            if (Type.Length != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (TraversalDepth.Length != 0)
            {
                hash ^= TraversalDepth.GetHashCode();
            }
            if (ExtendedProperties != false)
            {
                hash ^= ExtendedProperties.GetHashCode();
            }
            if (Toplevelhosts != false)
            {
                hash ^= Toplevelhosts.GetHashCode();
            }
            return(hash);
        }
Beispiel #19
0
        /// <summary>
        /// special handling for caught exception, to prevent exception pollution
        /// due to ClassNotFoundExceptions an other internal eceptions used for
        /// control flow.
        /// </summary>
        /// <param name="stopOnThrow"></param>
        private void SetupDefaultOnThrowBehavior(bool stopOnThrow)
        {
            var prevEventId = defaultBehaviorCaughtEventId;

            if (!stopOnThrow && prevEventId != -1)
            {
                if (Interlocked.CompareExchange(ref defaultBehaviorCaughtEventId, -1, prevEventId) == prevEventId)
                {
                    Debugger.EventRequest.ClearAsync(Jdwp.EventKind.Exception, prevEventId)
                    .Await(DalvikProcess.VmTimeout);
                }
            }
            else if (stopOnThrow && prevEventId == -1)
            {
                // 0 means all types.
                var refTypeId = new ClassId(Debugger.GetIdSizeInfo());

                List <EventModifier> mod = new List <EventModifier>
                {
                    new ExceptionOnlyModifier(refTypeId, true, false)
                };
                mod.AddRange(CaughtExceptionExcludeLocations.Select(pattern => new ClassExcludeModifier(pattern)));

                var eventId = Debugger.EventRequest.SetAsync(Jdwp.EventKind.Exception, Jdwp.SuspendPolicy.All, mod.ToArray())
                              .Await(DalvikProcess.VmTimeout);

                prevEventId = Interlocked.Exchange(ref defaultBehaviorCaughtEventId, eventId);
                if (prevEventId != -1)
                {
                    Debugger.EventRequest.ClearAsync(Jdwp.EventKind.Exception, prevEventId)
                    .Await(DalvikProcess.VmTimeout);
                }
            }
        }
Beispiel #20
0
        public override void Convert(byte[] rawData)
        {
            uint       uint32    = DBCRecordConverter.GetUInt32(rawData, 1);
            RaceId     race      = (RaceId)((int)uint32 & (int)byte.MaxValue);
            ClassId    clssId    = (ClassId)((uint32 & 65280U) >> 8);
            GenderType gender    = (GenderType)((uint32 & 16711680U) >> 16);
            Archetype  archetype = ArchetypeMgr.GetArchetype(race, clssId);

            if (archetype == null)
            {
                return;
            }
            List <ItemStack> initialItems = archetype.GetInitialItems(gender);

            for (int field = 2; field <= 25; ++field)
            {
                int itemId = DBCRecordConverter.GetInt32(rawData, field);
                if (itemId > 0)
                {
                    ItemTemplate template = ItemMgr.GetTemplate((Asda2ItemId)itemId);
                    if (template == null)
                    {
                        LogManager.GetCurrentClassLogger()
                        .Warn("Missing initial Item in DB: " + (object)itemId + " (" + (object)(uint)itemId +
                              ")");
                    }
                    else if (template.IsStackable)
                    {
                        int index = initialItems.FindIndex((Predicate <ItemStack>)(stack =>
                                                                                   (long)stack.Template.Id == (long)itemId));
                        if (index > -1)
                        {
                            initialItems[index] = new ItemStack()
                            {
                                Template = template,
                                Amount   = initialItems[index].Amount + 1
                            }
                        }
                        ;
                        else
                        {
                            initialItems.Add(new ItemStack()
                            {
                                Template = template,
                                Amount   = template.IsAmmo ? template.MaxAmount : 1
                            });
                        }
                    }
                    else
                    {
                        initialItems.Add(new ItemStack()
                        {
                            Template = template,
                            Amount   = 1
                        });
                    }
                }
            }
        }
Beispiel #21
0
 private void resetFormToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ClassId.Clear();
     Std.Clear();
     Div.Clear();
     Shedule.Clear();
     ClassId.Focus();
 }
Beispiel #22
0
 /// <summary>Returns the Class with the given type</summary>
 public static BaseClass GetClass(ClassId id)
 {
     if ((long)id < BaseClasses.Length)
     {
         return(BaseClasses[(uint)id]);
     }
     return(null);
 }
Beispiel #23
0
 public static SpellLine[] GetLines(ClassId clss)
 {
     if ((int)clss < SpellLines.SpellLinesByClass.Length)
     {
         return(SpellLines.SpellLinesByClass[(int)clss]);
     }
     return((SpellLine[])null);
 }
Beispiel #24
0
        public void GetClassIdTest()
        {
            var className = "Fonzie";
            var classId   = new ClassId(className);
            var product   = new DiaryProduct(classId, new ObjectId());

            GetClassIdTest(product, className);
        }
Beispiel #25
0
        private void StudentFrm_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dataSet1.StudentsTBL' table. You can move, or remove it, as needed.
            this.studentsTBLTableAdapter.Fill(this.dataSet1.StudentsTBL);

            LabelClassName.Text = ClassName;
            LabelClassId.Text   = ClassId.ToString();
        }
Beispiel #26
0
 public static Archetype GetArchetype(RaceId race, ClassId clssId)
 {
     if (clssId >= (ClassId)WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength)
     {
         return((Archetype)null);
     }
     return(ArchetypeMgr.Archetypes[(uint)clssId]?[(uint)race]);
 }
Beispiel #27
0
        public PluginDataKey(Profiler.PluginData pluginData)
        {
            ClassId = Guid.Parse(pluginData.ClassID);

            Name = pluginData.Name;

            _hashCode = ClassId.GetHashCode();
        }
Beispiel #28
0
        public virtual void Validate(ValidationResult result)
        {
            ClassId.ValidateRequired(result, nameof(ClassId));

            StudentId.ValidateRequired(result, nameof(StudentId));

            StartedDateTime.ValidateRequired(result, nameof(StartedDateTime));
        }
Beispiel #29
0
 /// <summary>Returns the Class with the given type</summary>
 public static BaseClass GetClass(ClassId id)
 {
     if ((long)id < (long)ArchetypeMgr.BaseClasses.Length)
     {
         return(ArchetypeMgr.BaseClasses[(uint)id]);
     }
     return((BaseClass)null);
 }
Beispiel #30
0
 public static Archetype GetArchetype(RaceId race, ClassId clssId)
 {
     if ((uint)clssId >= WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength)
     {
         return null;
     }
     var clss = Archetypes[(uint)clssId];
     return clss != null ? clss[(uint)race] : null;
 }
Beispiel #31
0
        internal ClassType GetMirrorOf(ClassId classId)
        {
            if (classId == default(ClassId))
            {
                return(null);
            }

            return(new ClassType(this, classId));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Message" /> class.
        /// </summary>
        /// <param name="messageType">Type of the message.</param>
        /// <param name="classId">The class identifier.</param>
        /// <param name="commandId">The message identifier.</param>
        protected Message(MessageType messageType, ClassId classId, byte commandId)
        {
            _key = new Key(new Identifier(messageType, TechnologyType.Bluetooth_4_0_Single_Mode, classId, commandId));

            _header.MessageType = messageType;
            _header.TechnologyType = TechnologyType.Bluetooth_4_0_Single_Mode;
            _header.ClassId = classId;
            _header.CommandId = commandId;
        }
Beispiel #33
0
            public void Mutate(Student mutable)
            {
                Condition.ArgumentNotDefault(mutable, nameof(mutable));

                Condition.Require <InvalidOperationException>(StudentId.Equals(mutable.Id));
                Condition.Require <ArgumentException>(!ClassId.Equals(default(int)));

                mutable.Registrations.Single(r => r.ClassId.Equals(ClassId)).Grade = Grade;
            }
Beispiel #34
0
 /// <summary>
 /// Returns the corresponding <see cref="Archetype"/>.
 /// </summary>
 /// <exception cref="NullReferenceException">If Archetype does not exist</exception>
 public static Archetype GetArchetypeNotNull(RaceId race, ClassId clss)
 {
     Archetype type;
     if ((uint)clss >= WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength ||
         ((type = Archetypes[(uint)clss][(uint)race]) == null))
     {
         throw new ArgumentException(string.Format("Archetype \"{0} {1}\" does not exist.", race, clss));
     }
     return type;
 }
Beispiel #35
0
		public static ClassId[] GetIds(this ClassMask mask)
		{
			var ids = Utility.GetSetIndices((uint) mask);
			var classIds = new ClassId[ids.Length];
			for (var i = 0; i < ids.Length; i++)
			{
				var id = ids[i];
				classIds[i] = (ClassId) (id+1);
			}
			return classIds;
		}
Beispiel #36
0
 public ExternalDmgAmps(string modifierName,
     double sourceTeam,
     string amp,
     string sourceSpellName,
     ClassId heroID,
     DamageType type)
 {
     ModifierName = modifierName;
     SourceTeam = sourceTeam;
     Amp = amp;
     SourceSpellName = sourceSpellName;
     HeroID = heroID;
     Type = type;
 }
Beispiel #37
0
 public ExternalDmgReductions(string modifierName,
     double sourceTeam,
     string reduce,
     string sourceSpellName,
     ClassId heroID,
     float type,
     bool magicOnly)
 {
     ModifierName = modifierName;
     SourceTeam = sourceTeam;
     Reduce = reduce;
     SourceSpellName = sourceSpellName;
     HeroID = heroID;
     Type = type;
     MagicOnly = magicOnly;
 }
Beispiel #38
0
 public Prediction(string unitName,
     ClassId unitClassId,
     Vector3 speed,
     float rotSpeed,
     Vector3 lastPosition,
     float lastRotR,
     float lasttick)
 {
     UnitName = unitName;
     UnitClassId = unitClassId;
     Speed = speed;
     RotSpeed = rotSpeed;
     LastPosition = lastPosition;
     LastRotR = lastRotR;
     Lasttick = lasttick;
 }
Beispiel #39
0
		static void AddSpellLines(ClassId clss, SpellLine[] lines)
		{
			SpellLinesByClass[(int)clss] = lines;
			foreach (var line in lines)
			{
				ById[(int)line.LineId] = line;
				Spell last = null;
				foreach (var spell in line)
				{
					if (last != null)
					{
						spell.PreviousRank = last;
						last.NextRank = spell;
					}
					last = spell;
				}
			}
		}
Beispiel #40
0
		/// <summary>
		/// Adds all skills of that race/class combination with max value
		/// </summary>
		/// <param name="learnAbilities">Whether to also learn all abilities, related to the given skills.</param>
		public void LearnAll(RaceId race, ClassId clss, bool learnAbilities)
		{
			foreach (var info in SkillHandler.RaceClassInfos[(int)race][(int)clss].Values)
			{
				var skill = GetOrCreate(info.SkillLine.Id, true);
				if (skill != null)
				{
					skill.LearnMax();
					if (learnAbilities)
					{
						skill.LearnAllAbilities();
					}
				}
			}
		}
Beispiel #41
0
		public static List<SpellLine> GetAffectedSpellLines(ClassId clss, uint[] mask)
		{
			var lines = SpellLines.GetLines(clss);
			var affected = new List<SpellLine>();
			if (lines != null)
			{
				foreach (var line in lines)
				{
					foreach (var spell in line)
					{
						if (spell.MatchesMask(mask))
						{
							affected.Add(line);
							break;
						}
					}
				}
			}
			return affected;
		}
Beispiel #42
0
 internal static BaseClass CreateClass(ClassId id)
 {
     return ClassCreators[(int)id]();
 }
Beispiel #43
0
		public static SpellLine[] GetLines(ClassId clss)
		{
			return SpellLinesByClass[(int)clss];
		}
        public Error InvokeObjectMethod(out Value returnValue, out TaggedObjectId thrownException, ObjectId @object, ThreadId thread, ClassId @class, MethodId method, InvokeOptions options, Value[] arguments)
        {
            if (thread == default(ThreadId))
                throw new ArgumentException();

            byte[] packet = new byte[HeaderSize + ObjectIdSize + ThreadIdSize + ClassIdSize + MethodIdSize + sizeof(int)];
            WriteObjectId(packet, HeaderSize, @object);
            WriteObjectId(packet, HeaderSize + ObjectIdSize, thread);
            WriteReferenceTypeId(packet, HeaderSize + ObjectIdSize + ThreadIdSize, @class);
            WriteMethodId(packet, HeaderSize + ObjectIdSize + ThreadIdSize + ClassIdSize, method);
            WriteInt32(packet, HeaderSize + ObjectIdSize + ThreadIdSize + ClassIdSize + MethodIdSize, arguments.Length);

            List<byte> packetData = new List<byte>(packet);
            foreach (Value argument in arguments)
            {
                switch (argument.Tag)
                {
                case Tag.Byte:
                    throw new NotImplementedException();

                case Tag.Char:
                    throw new NotImplementedException();

                case Tag.Float:
                    throw new NotImplementedException();

                case Tag.Double:
                    throw new NotImplementedException();

                case Tag.Int:
                    throw new NotImplementedException();

                case Tag.Long:
                    throw new NotImplementedException();

                case Tag.Short:
                    throw new NotImplementedException();

                case Tag.Boolean:
                    throw new NotImplementedException();

                case Tag.Array:
                case Tag.Object:
                case Tag.String:
                case Tag.Thread:
                case Tag.ThreadGroup:
                case Tag.ClassLoader:
                case Tag.ClassObject:
                    throw new NotImplementedException();

                case Tag.Void:
                    throw new NotImplementedException();

                case Tag.Invalid:
                default:
                    throw new InvalidOperationException();
                }
            }

            byte[] optionsData = new byte[sizeof(int)];
            WriteInt32(optionsData, 0, (int)options);
            packetData.AddRange(optionsData);

            packet = packetData.ToArray();
            int id = GetMessageId();
            SerializeHeader(packet, id, ObjectReferenceCommand.InvokeMethod);

            byte[] response = SendPacket(id, packet);
            Error errorCode = ReadErrorCode(response);
            if (errorCode != Error.None)
            {
                returnValue = default(Value);
                thrownException = default(TaggedObjectId);
                return errorCode;
            }

            int offset = HeaderSize;
            returnValue = ReadValue(response, ref offset);
            thrownException = ReadTaggedObjectId(response, ref offset);
            return Error.None;
        }
Beispiel #45
0
        /// <summary>
        /// Returns all archetypes with the given race/class combination.
        /// 0 for race or class means all.
        /// </summary>
        /// <returns></returns>
        public static List<Archetype> GetArchetypes(RaceId race, ClassId clss)
        {
            if ((uint)clss >= WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength)
            {
                return null;
            }

            var list = new List<Archetype>();
            if (clss == 0)
            {
                // applies to all classes
                foreach (var raceArchetypes in Archetypes)
                {
                    if (raceArchetypes != null)
                    {
                        if (race == 0)
                        {
                            // applies to all classes and races
                            foreach (var archetype in raceArchetypes)
                            {
                                if (archetype != null)
                                {
                                    list.Add(archetype);
                                }
                            }
                        }
                        else
                        {
                            if (raceArchetypes[(uint)race] != null)
                            {
                                list.Add(raceArchetypes[(uint)race]);
                            }
                        }
                    }
                }
            }
            else
            {
                if (race == 0)
                {
                    // applies to all races
                    foreach (var archetype in Archetypes[(uint)clss])
                    {
                        if (archetype != null)
                        {
                            list.Add(archetype);
                        }
                    }
                }
                else
                {
                    // just one
                    if (Archetypes[(uint)clss][(uint)race] != null)
                    {
                        list.Add(Archetypes[(uint)clss][(uint)race]);
                    }
                }
            }

            if (list.Count == 0)
            {
                return null;
            }
            return list;
        }
Beispiel #46
0
        // sub_69138
        public static bool RaceStatLevelRestricted(ClassId _class, Player player)
        {
            bool race_limited = false;

            int class_lvl = player.ClassLevel[(int)_class];

            if (class_lvl > 0)
            {
                switch (player.race)
                {
                    case Race.dwarf:
                        if (_class == ClassId.fighter)
                        {
                            if ((class_lvl == 8 && player.stats2.Str.full == 17) ||
                                (class_lvl == 7 && player.stats2.Str.full < 17))
                            {
                                race_limited = true;
                            }
                        }
                        break;

                    case Race.elf:
                        if (_class == ClassId.fighter)
                        {
                            if ((class_lvl == 7) ||
                                (class_lvl == 6 && player.stats2.Str.full == 17) ||
                                (class_lvl == 5 && player.stats2.Str.full < 17))
                            {
                                race_limited = true;
                            }
                        }
                        break;

                    case Race.gnome:
                        if (_class == ClassId.fighter)
                        {
                            if ((class_lvl == 6) ||
                                (class_lvl == 5 && player.stats2.Str.full < 18))
                            {
                                race_limited = true;
                            }
                        }
                        break;

                    case Race.half_elf:
                        if (_class == ClassId.cleric &&
                            class_lvl == 5)
                        {
                            race_limited = true;
                        }
                        else if (_class == ClassId.fighter)
                        {
                            if (class_lvl == 8 ||
                                (class_lvl == 7 && player.stats2.Str.full == 17) ||
                                (class_lvl == 6 && player.stats2.Str.full < 17))
                            {
                                race_limited = true;
                            }
                        }
                        break;

                    case Race.halfling:
                        if (_class == ClassId.fighter)
                        {
                            if ((class_lvl == 6) ||
                                (class_lvl == 5 && player.stats2.Str.full == 17) ||
                                (class_lvl == 4 && player.stats2.Str.full < 17))
                            {
                                race_limited = true;
                            }
                        }
                        break;
                }
            }

            if (Cheats.no_race_level_limits)
            {
                race_limited = false;
            }

            return race_limited;
        }
Beispiel #47
0
        internal static int con_bonus(ClassId classId)
        {
            int bonus;
            int stat = gbl.SelectedPlayer.stats2.Con.full;

            if (stat == 3)
            {
                bonus = -2;
            }
            else if (stat >= 4 && stat <= 6)
            {
                bonus = -1;
            }
            else if (stat >= 7 && stat <= 14)
            {
                bonus = 0;
            }
            else if (stat == 15)
            {
                bonus = 1;
            }
            else if (stat == 16)
            {
                bonus = 1;
            }
            else if (classId == ClassId.fighter || classId == ClassId.ranger || classId == ClassId.paladin)
            {
                bonus = stat - 14;
            }
            else
            {
                bonus = 2;
            }

            return bonus;
        }
Beispiel #48
0
		public static bool HasAnyFlag(this ClassMask flags, ClassId clss)
		{
			return (flags & (ClassMask)(1 << (int) (clss-1))) != 0;
		}
Beispiel #49
0
 public static float GetUnModifiedClassMeleeCritChanceValue(int level, ClassId id)
 {
     return GetValuePerRating(ClassMeleeCritChance, level, id);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Response"/> class.
 /// </summary>
 /// <param name="classId">The class identifier.</param>
 /// <param name="commandId">The command identifier.</param>
 protected Response(ClassId classId, byte commandId)
     : base(MessageType.Response, classId, commandId)
 {
 }
 public Error CreateClassInstance(out TaggedObjectId newObject, out TaggedObjectId thrownException, ClassId @class, ThreadId thread, MethodId method, InvokeOptions options, Value[] arguments)
 {
     throw new NotImplementedException();
 }
Beispiel #52
0
        public static bool RaceClassLimit(int class_lvl, Player player, ClassId _class)
        {
            bool race_limited = false;

            switch (player.race)
            {
                case Race.dwarf:
                    if (_class == ClassId.fighter)
                    {
                        if (class_lvl == 9 ||
                            (class_lvl == 8 && player.stats2.Str.full == 17) ||
                            (class_lvl == 7 && player.stats2.Str.full < 17))
                        {
                            race_limited = true;
                        }
                    }
                    break;

                case Race.elf:
                    if (_class == ClassId.fighter)
                    {
                        if (class_lvl == 7 ||
                            (class_lvl == 6 && player.stats2.Str.full == 17) ||
                            (class_lvl == 5 && player.stats2.Str.full < 17))
                        {
                            race_limited = true;
                        }
                    }

                    if (_class == ClassId.magic_user)
                    {
                        if (class_lvl == 11 ||
                            (class_lvl == 9 && player.stats2.Int.full < 17) ||
                            (class_lvl == 10 && player.stats2.Int.full == 17))
                        {
                            race_limited = true;
                        }
                    }
                    break;

                case Race.gnome:
                    if (_class == ClassId.fighter)
                    {
                        if (class_lvl == 6 ||
                            (class_lvl == 5 && player.stats2.Str.full < 18))
                        {
                            race_limited = true;
                        }
                    }
                    break;

                case Race.half_elf:
                    if (_class == ClassId.cleric && class_lvl == 5)
                    {
                        race_limited = true;
                    }
                    else
                    {
                        if (_class == ClassId.fighter || _class == ClassId.ranger)
                        {
                            if (class_lvl == 8 ||
                                (class_lvl == 7 && player.stats2.Str.full == 17) ||
                                (class_lvl == 6 && player.stats2.Str.full < 17))
                            {
                                race_limited = true;
                            }
                        }

                        if (_class == ClassId.magic_user)
                        {
                            if (class_lvl == 8 ||
                                (class_lvl == 7 && player.stats2.Str.full == 17) ||
                                (class_lvl == 6 && player.stats2.Str.full < 17))
                            {
                                race_limited = true;
                            }
                        }
                    }
                    break;

                case Race.halfling:
                    if (_class == ClassId.fighter)
                    {
                        if (class_lvl == 6 ||
                            (class_lvl == 5 && player.stats2.Str.full == 17) ||
                            (class_lvl == 4 && player.stats2.Str.full < 17))
                        {
                            race_limited = true;
                        }
                    }

                    break;

            }

            if (Cheats.no_race_level_limits)
            {
                race_limited = false;
            }

            return race_limited;
        }
Beispiel #53
0
        /// <summary>
        /// Gets the modified value from the table ClassMeleeCritChance from the correct index.
        /// Returns the modified value matching the format "XX stat for 1% chance"
        /// </summary>
        /// <param name="level"></param>
        /// <param name="id"></param>
        /// <returns>The modified value matching the format "XX rating for 1% chance"</returns>
        public static float GetClassMeleeCritChanceValue(int level, ClassId id)
        {
            var value = GetValuePerRating(ClassMeleeCritChance, level, id);
            return ModifyValue(value);
			//return value;
        }
Beispiel #54
0
	    public static SpellLine[] GetLines(ClassId clss)
		{
		    return (int)clss >= SpellLinesByClass.Length ? null : SpellLinesByClass[(int)clss];
		}
Beispiel #55
0
 /// <summary>
 /// Gets the real value from the table (unmodified)
 /// NOTE: Only for ClassSpellCritChance, ClassMeleeCritChance
 /// Will return the wrong values if used incorrectly.
 /// </summary>
 /// <param name="table">The table (ClassSpellCritChance, ClassMeleeCritChance)</param>
 /// <param name="level">Level of the character</param>
 /// <param name="classId">ClassId of the character</param>
 /// <returns></returns>
 private static float GetValuePerRating(float[] table, int level, ClassId classId)
 {
     if (level > 100)
     {
         level = 100;
     }
     if (level < 1)
     {
         level = 1;
     }
     return table[100*(int) classId + level - 101];
 }
Beispiel #56
0
        /* sub_6AD3E */
        internal static bool SecondClassAllowed(ClassId _class, Player player)
        {
            var firstClass = HumanCurrentClass_Unknown(player);
            bool var_2 = _class != firstClass;

            int var_3 = 0;
            while (var_3 <= 5 &&
                (gbl.class_stats_min[(int)firstClass][var_3] < 9 || player.stats2[var_3].cur > 14))
            {
                var_3++;
            }

            var_2 = (var_2 == true && var_3 > 5);
            var_3 = 0;

            while (var_3 <= 5 &&
                (gbl.class_stats_min[(int)_class][var_3] < 9 || player.stats2[var_3].cur > 16))
            {
                var_3++;
            }

            var_2 = (var_2 == true && var_3 > 5);

            byte var_4 = 1;

            while (gbl.class_alignments[(int)_class, 0] >= var_4 &&
                gbl.class_alignments[(int)_class, var_4] != player.alignment)
            {
                var_4++;
            }

            if (var_2 == false ||
                gbl.class_alignments[(int)_class, 0] < var_4)
            {
                var_2 = false;
            }
            else
            {
                var_2 = true;
            }

            return var_2;
        }
        /// <summary>
        /// special handling for caught exception, to prevent exception pollution
        /// due to ClassNotFoundExceptions an other internal eceptions used for
        /// control flow.
        /// </summary>
        /// <param name="stopOnThrow"></param>
        private void SetupDefaultOnThrowBehavior(bool stopOnThrow)
        {
            var prevEventId = defaultBehaviorCaughtEventId;

            if (!stopOnThrow && prevEventId != -1)
            {
                if (Interlocked.CompareExchange(ref defaultBehaviorCaughtEventId, -1, prevEventId) == prevEventId)
                {
                    Debugger.EventRequest.ClearAsync(Jdwp.EventKind.Exception, prevEventId)
                                         .Await(DalvikProcess.VmTimeout);
                }
            }
            else if(stopOnThrow && prevEventId == -1)
            {
                // 0 means all types.
                var refTypeId = new ClassId(Debugger.GetIdSizeInfo());

                List<EventModifier> mod = new List<EventModifier>
                {
                    new ExceptionOnlyModifier(refTypeId, true, false)
                };
                mod.AddRange(CaughtExceptionExcludeLocations.Select(pattern => new ClassExcludeModifier(pattern)));

                var eventId = Debugger.EventRequest.SetAsync(Jdwp.EventKind.Exception, Jdwp.SuspendPolicy.All, mod.ToArray())
                                                   .Await(DalvikProcess.VmTimeout);

                prevEventId = Interlocked.Exchange(ref defaultBehaviorCaughtEventId, eventId);
                if (prevEventId != -1)
                {
                    Debugger.EventRequest.ClearAsync(Jdwp.EventKind.Exception, prevEventId)
                                         .Await(DalvikProcess.VmTimeout);
                }
            }
        }
Beispiel #58
0
 /// <summary>
 /// Returns the Class with the given type
 /// </summary>
 public static BaseClass GetClass(ClassId id)
 {
     return (uint)id >= BaseClasses.Length ? null : BaseClasses[(uint)id];
 }
Beispiel #59
0
 /// <summary>
 /// Gets an enumerator of characters based on their class.
 /// </summary>
 /// <param name="entClass">the class to search for</param>
 /// <returns>a list of <see cref="Character" /> objects who are of the given class</returns>
 public static ICollection<Character> GetCharactersOfClass(ClassId entClass)
 {
     var list = new List<Character>(s_namedEntities.Count);
     using (worldLock.EnterReadLock())
     {
         foreach (INamedEntity chr in s_namedEntities.Values)
         {
             if (chr is Character && ((Character)chr).Class == entClass)
             {
                 list.Add((Character)chr);
             }
         }
     }
     return list;
 }
Beispiel #60
0
 /// <summary>
 /// Returns a list of all SpellLines that are affected by the given spell family set (very long bit field)
 /// </summary>
 public static HashSet<SpellLine> GetAffectedSpellLines(ClassId clss, uint[] mask)
 {
     var lines = SpellLines.GetLines(clss);
     var affected = new HashSet<SpellLine>();
     if (lines != null)
     {
         foreach (var line in lines)
         {
             foreach (var spell in line)
             {
                 if (spell.MatchesMask(mask))
                 {
                     affected.Add(line);
                     break;
                 }
             }
         }
         //foreach (var spell in ById)
         //{
         //    if (spell != null && spell.ClassId == clss && spell.MatchesMask(mask))
         //    {
         //        if (spell.Line != null)
         //        {
         //            affected.Add(line);
         //        }
         //        break;
         //    }
         //}
     }
     return affected;
 }