public NavGump(NavBeacon nav) : base(50, 50) { temp = nav; Closable = true; Dragable = true; Resizable = false; AddPage(0); AddBackground(10, 10, 225, 425, 9270); AddAlphaRegion(7, 7, 235, 435); AddLabel(40, 15, 1152, "Routes"); AddLabel(165, 15, 1152, "Weight"); AddButton(91, 398, 247, 248, 1, GumpButtonType.Reply, 0); //Okay Button -> # 1 int itemsThisPage = 0; int nextPageNumber = 1; string[] ary = Enum.GetNames(typeof(NavDestinations)); for (int i = 1; i < ary.Length; i++) { if (ary[i] != null) { if (itemsThisPage >= 7 || itemsThisPage == 0) { itemsThisPage = 0; if (nextPageNumber != 1) { AddButton(190, 399, 4005, 4007, 2, GumpButtonType.Page, nextPageNumber); //Forward button -> #2 } AddPage(nextPageNumber++); if (nextPageNumber != 2) { AddButton(29, 399, 4014, 4016, 3, GumpButtonType.Page, nextPageNumber - 2); //Back Button -> #3 } } AddTextEntry(180, 55 + (45 * itemsThisPage), 1152, 20, 0xFA5, (i + 500), nav.GetWeight(i).ToString()); AddLabel(40, 55 + (45 * itemsThisPage), 1152, ary[i]); itemsThisPage++; } } }
public NavGump(NavBeacon nav) : base( 50, 50 ) { temp = nav; Closable=true; Dragable=true; Resizable=false; AddPage(0); AddBackground(10, 10, 225, 425, 9270); AddAlphaRegion(7, 7, 235, 435); AddLabel(40, 15, 1152, "Routes"); AddLabel(165, 15, 1152, "Weight"); AddButton(91, 398, 247, 248, 1, GumpButtonType.Reply, 0); //Okay Button -> # 1 int itemsThisPage = 0; int nextPageNumber = 1; string[] ary = Enum.GetNames(typeof(NavDestinations)); for( int i = 1; i < ary.Length; i++ ) { if( ary[i] != null ) { if( itemsThisPage >= 7 || itemsThisPage == 0) { itemsThisPage = 0; if( nextPageNumber != 1) { AddButton(190, 399, 4005, 4007, 2, GumpButtonType.Page, nextPageNumber); //Forward button -> #2 } AddPage( nextPageNumber++ ); if( nextPageNumber != 2) { AddButton(29, 399, 4014, 4016, 3, GumpButtonType.Page, nextPageNumber-2); //Back Button -> #3 } } AddTextEntry( 180, 55 + ( 45 * itemsThisPage ), 1152, 20, 0xFA5, (i+ 500), nav.GetWeight(i).ToString() ); AddLabel(40, 55 + ( 45 * itemsThisPage ) , 1152, ary[i]); itemsThisPage++; } } }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); m_CurrentAI = (AIType)reader.ReadInt(); m_DefaultAI = (AIType)reader.ReadInt(); m_iRangePerception = reader.ReadInt(); m_iRangeFight = reader.ReadInt(); m_iTeam = reader.ReadInt(); m_dActiveSpeed = reader.ReadDouble(); m_dPassiveSpeed = reader.ReadDouble(); m_dCurrentSpeed = reader.ReadDouble(); double activeSpeed = m_dActiveSpeed; double passiveSpeed = m_dPassiveSpeed; // SpeedInfo.GetSpeeds( this, ref activeSpeed, ref passiveSpeed ); bool isStandardActive = false; for ( int i = 0; !isStandardActive && i < m_StandardActiveSpeeds.Length; ++i ) isStandardActive = ( m_dActiveSpeed == m_StandardActiveSpeeds[i] ); bool isStandardPassive = false; for ( int i = 0; !isStandardPassive && i < m_StandardPassiveSpeeds.Length; ++i ) isStandardPassive = ( m_dPassiveSpeed == m_StandardPassiveSpeeds[i] ); if ( isStandardActive && m_dCurrentSpeed == m_dActiveSpeed ) m_dCurrentSpeed = activeSpeed; else if ( isStandardPassive && m_dCurrentSpeed == m_dPassiveSpeed ) m_dCurrentSpeed = passiveSpeed; if ( isStandardActive ) m_dActiveSpeed = activeSpeed; if ( isStandardPassive ) m_dPassiveSpeed = passiveSpeed; if ( m_iRangePerception == OldRangePerception ) m_iRangePerception = DefaultRangePerception; m_pHome.X = reader.ReadInt(); m_pHome.Y = reader.ReadInt(); m_pHome.Z = reader.ReadInt(); if ( version >= 1 ) { m_iRangeHome = reader.ReadInt(); int i, iCount; iCount = reader.ReadInt(); for ( i=0; i< iCount; i++ ) { string str = reader.ReadString(); Type type = Type.GetType( str ); if ( type != null ) { m_arSpellAttack.Add( type ); } } iCount = reader.ReadInt(); for ( i=0; i< iCount; i++ ) { string str = reader.ReadString(); Type type = Type.GetType( str ); if ( type != null ) { m_arSpellDefense.Add( type ); } } } else { m_iRangeHome = 0; } if ( version >= 2 ) { m_FightMode = ( FightMode )reader.ReadInt(); m_bControled = reader.ReadBool(); m_ControlMaster = reader.ReadMobile(); m_ControlTarget = reader.ReadMobile(); m_ControlDest = reader.ReadPoint3D(); m_ControlOrder = (OrderType) reader.ReadInt(); m_dMinTameSkill = reader.ReadDouble(); if ( version < 9 ) reader.ReadDouble(); m_bTamable = reader.ReadBool(); m_bSummoned = reader.ReadBool(); if ( m_bSummoned ) { m_SummonEnd = reader.ReadDeltaTime(); new UnsummonTimer( m_ControlMaster, this, m_SummonEnd - DateTime.Now ).Start(); } m_iControlSlots = reader.ReadInt(); } else { m_FightMode = FightMode.All | FightMode.Closest; m_bControled = false; m_ControlMaster = null; m_ControlTarget = null; m_ControlOrder = OrderType.None; } if ( version >= 3 ) // loyalty redo { m_Loyalty = (PetLoyalty)reader.ReadInt(); if (version < 23) m_Loyalty = (PetLoyalty)((int)m_Loyalty * 10); } else m_Loyalty = PetLoyalty.WonderfullyHappy; if ( version >= 4 ) m_CurrentWayPoint = reader.ReadItem() as WayPoint; if ( version >= 5 ) m_SummonMaster = reader.ReadMobile(); if ( version >= 6 ) { m_HitsMax = reader.ReadInt(); m_StamMax = reader.ReadInt(); m_ManaMax = reader.ReadInt(); m_DamageMin = reader.ReadInt(); m_DamageMax = reader.ReadInt(); } if ( version >= 7 && version < 18) // Adam: eliminate crazy resistances ver. 18 { int dummy; dummy = reader.ReadInt(); // PhysicalResistance dummy = reader.ReadInt(); // PhysicalDamage dummy = reader.ReadInt(); // FireResistance dummy = reader.ReadInt(); // FireDamage dummy = reader.ReadInt(); // ColdResistance dummy = reader.ReadInt(); // ColdDamage dummy = reader.ReadInt(); // PoisonResistance dummy = reader.ReadInt(); // PoisonDamage dummy = reader.ReadInt(); // EnergyResistance dummy = reader.ReadInt(); // EnergyDamage } //if ( version >= 7 && version >= 18) // Adam: eliminate crazy resistances ver. 18 //{ // m_PhysicalResistance = reader.ReadInt(); // m_PhysicalDamage = reader.ReadInt(); //} if ( version >= 8 ) m_Owners = reader.ReadMobileList(); else m_Owners = new ArrayList(); if ( version >= 10 ) { m_IsDeadPet = reader.ReadBool(); m_IsBonded = reader.ReadBool(); m_BondingBegin = reader.ReadDateTime(); m_OwnerAbandonTime = reader.ReadDateTime(); } if ( version >= 11 ) m_HasGeneratedLoot = reader.ReadBool(); else m_HasGeneratedLoot = true; if( version >= 12 ) { m_StatLossTime = reader.ReadDateTime(); } if( version >= 13 ) //Pigpen - Addition for IOB Sytem { m_IOBAlignment = (IOBAlignment)reader.ReadInt(); } if( version >= 14 ) //Pix: IOBLeader/IOBFollower { m_IOBFollower = reader.ReadBool(); m_IOBLeader = reader.ReadMobile(); } if( version >= 15 ) //Pix: Spawner { m_Spawner = (Spawner)reader.ReadItem(); } if( version >= 16 ) //Pix: Lifespan { m_lifespan = reader.ReadDeltaTime(); } if( version >= 17 && version < 30 ) //Kit: preferred target ai { // eliminated in version 30 //m_preferred = reader.ReadBool(); //m_preferredTargetType = reader.ReadMobile(); //Sortby = (SortTypes)reader.ReadInt(); reader.ReadBool(); reader.ReadMobile(); reader.ReadInt(); } if( version >= 18 ) //Adam: eliminate stupid resistances { // see above - version 7 } if( version >= 19 ) //Kit: NavStar { Destination = reader.ReadPoint3D(); dest = (NavDestinations)reader.ReadInt(); Nav = (NavBeacon)reader.ReadItem(); } if( version >= 20 ) //Adam: convert BardImmune from an override to a property { m_bBardImmune = reader.ReadBool(); } if(version >= 21 ) { loyaltyfeed = reader.ReadDateTime(); } if(version >= 22) { m_Flags = (CreatureFlags)reader.ReadInt(); } if (version >= 24) { m_ControlSlotModifier = reader.ReadDouble(); m_Patience = reader.ReadInt(); m_Wisdom = reader.ReadInt(); m_Temper = reader.ReadInt(); m_MaxLoyalty = reader.ReadInt(); } if (version >= 25) { m_HitsRegenGene = reader.ReadDouble(); m_ManaRegenGene = reader.ReadDouble(); m_StamRegenGene = reader.ReadDouble(); } // note the LESS THAN symbol instead of GTE // this is an example of run-once deserialization code - every old critter will run this once. if (version < 26) InitializeGenes(); // version 27 if (version >= 27) m_LifespanMinutes = reader.ReadInt(); // we need to reset this because reading the Flags will have turned it off // the flags value will obnly be valid when version >= 28 if (version < 28) IsScaredOfScaryThings = true; /* versions < 29 get their FightMode upgraded to the new [Flags] version public enum FightMode { None, // Never focus on others Aggressor, // Only attack Aggressors Strongest, // Attack the strongest Weakest, // Attack the weakest Closest, // Attack the closest Evil, // Only attack aggressor -or- negative karma Criminal, // Attack the criminals Player } */ if (version < 29) { switch ((int)m_FightMode) { // now outdated values case 0: m_FightMode = (FightMode)0x00; break; /*None*/ case 1: m_FightMode = (FightMode)0x01; break; /*Aggressor*/ case 2: m_FightMode = (FightMode)0x02; break; /*Strongest*/ case 3: m_FightMode = (FightMode)0x04; break; /*Weakest*/ case 4: m_FightMode = (FightMode)0x08; break; /*Closest*/ case 5: m_FightMode = (FightMode)0x10; break; /*Evil*/ case 6: m_FightMode = (FightMode)0x20; break; /*Criminal*/ case 7: m_FightMode = (FightMode)0x40; break; /*Player*/ } } /* versions < 30 get their FightMode upgraded to the new [Flags] version public enum FightMode { None = 0x00, // Never focus on others Aggressor = 0x01, // Only attack Aggressors Strongest = 0x02, // Attack the strongest Weakest = 0x04, // Attack the weakest Closest = 0x08, // Attack the closest Evil = 0x10, // Only attack aggressor -or- negative karma Criminal = 0x20, // Attack the criminals Player = 0x40 // Attack Players (Vampires for feeding on blood) } */ if (version < 30) { switch ((int)m_FightMode) { case 0x00 /*None*/ : m_FightMode = FightMode.None; break; case 0x01 /*Aggressor*/ : m_FightMode = FightMode.Aggressor; break; case 0x02 /*Strongest*/ : m_FightMode = FightMode.All | FightMode.Strongest; break; case 0x04 /*Weakest*/ : m_FightMode = FightMode.All | FightMode.Weakest; break; case 0x08 /*Closest*/ : m_FightMode = FightMode.All | FightMode.Closest; break; case 0x10 /*Evil*/ : m_FightMode = FightMode.Aggressor | FightMode.Evil; break; case 0x20 /*Criminal*/ : m_FightMode = FightMode.Aggressor | FightMode.Criminal; break; case 0x40 /*Player*/ : m_FightMode = FightMode.All | FightMode.Closest; break; } } // new Fight Style for enhanced AI if (version >= 31) m_FightStyle = (FightStyle)reader.ReadInt(); // version 32, read in the AI data, but we must construct the AI object first ChangeAIType(m_CurrentAI); if (version >= 32) { if (AIObject != null) AIObject.Deserialize(reader); } if (version >= 33) { m_ConstantFocus = reader.ReadMobile(); } // ------------------------------- // After all the reading is done // ------------------------------- RefreshLifespan(); CheckStatTimers(); AddFollowers(); }