public Jerky(IOBAlignment kin) : this() { if (kin == IOBAlignment.Orcish) { Name = "orc meat"; } }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (m.Player && m.Alive && InRange(m, 10) && !InRange(oldLocation, 10) && InLOS(m) && IOBSystem.IsEnemy(this, m)) { Direction = GetDirectionTo(m); string warning = null; switch (Utility.Random(6)) { case 0: warning = "I warn you, {0}, you would do well to leave this area before someone shows you the world of gray."; break; case 1: warning = "It would be wise to leave this area, {0}, lest your head become my commanders' trophy."; break; case 2: warning = "You are bold, {0}, for one of the meager {1}. Leave now, lest you be taught the taste of dirt."; break; case 3: warning = "Your presence here is an insult, {0}. Be gone now, knave."; break; case 4: warning = "Dost thou wish to be hung by your toes, {0}? Nay? Then come no closer."; break; case 5: warning = "Hey, {0}. Yeah, you. Get out of here before I beat you with a stick."; break; } IOBAlignment faction = IOBSystem.GetIOBAlignment(m); Say(warning, m.Name, faction == IOBAlignment.None ? "civilians" : IOBSystem.GetIOBName(faction)); } }
/// <summary> /// Returns list of guard types a kin is eligible to hire /// </summary> /// <param name="alignment"></param> /// <returns></returns> public static List <KinFactionGuardTypes> GetEligibleGuardTypes(IOBAlignment alignment) { List <KinFactionGuardTypes> results = new List <KinFactionGuardTypes>(); foreach (KinFactionGuardTypes guardType in Enum.GetValues(typeof(KinFactionGuardTypes))) { try { //See if this type exists and has a KinFactionGuardTypeAttribute Type t = SpawnerType.GetType(guardType.ToString().ToLower()); if (t != null) { bool addToList = true; KinFactionGuardTypeAttribute[] att = (KinFactionGuardTypeAttribute[])t.GetCustomAttributes(typeof(KinFactionGuardTypeAttribute), true); //Note here that if there isn't an attribute, all kins get added if (att != null && att.Length > 0 && att[0].EligibleKin != null && att[0].EligibleKin.Count > 0) { if (att[0].EligibleKin != null && !att[0].EligibleKin.Contains(alignment)) { addToList = false; } } if (addToList) { results.Add(guardType); } } } catch { } } return(results); }
/// <summary> /// Initializes a new instance of the <see cref="KinCityData"/> class. /// </summary> /// <param name="city">The city.</param> public KinCityData(KinFactionCities city) { this.m_City = city; this.m_CaptureTime = DateTime.Now; this.m_ControlingKin = IOBAlignment.None; this.m_GuardOption = GuardOptions.LordBritish; this.SetAllNPCFlags(); }
public void IOBKick() { string message = string.Format("Your guild has been kicked from the {0} by the consensus of other {0}. You cannot rejoin for {1} days.", Engines.IOBSystem.IOBSystem.GetIOBName(IOBAlignment), m_JoinDelay); GuildMessage(message); m_LastIOBChangeTime = DateTime.Now; m_IOBAlignment = IOBAlignment.None; }
public void AddPoints(IOBAlignment kin, double points) { foreach (KinCapturePoints point in this) { if (point.Obj is IOBAlignment && (IOBAlignment)point.Obj == kin) { point.AddPoints(points); return; } } Add(new KinCapturePoints(kin, points)); }
public KinRansomChest(IOBAlignment IOBAlignment, bool bFill) : base(0xE41) { this.IOBAlignment = IOBAlignment; this.Movable = false; this.TrapType = Utility.RandomBool() ? TrapType.PoisonTrap : TrapType.ExplosionTrap; this.TrapPower = 100; this.Locked = true; this.RequiredSkill = 100; this.LockLevel = this.RequiredSkill - 10; this.MaxLockLevel = this.RequiredSkill + 40; if (bFill == true) { KinRansomChest.Fill(this); } }
/// <summary> /// Initializes a new instance of the <see cref="KinCityData"/> class. /// </summary> /// <param name="reader">The reader.</param> public KinCityData(BinaryFileReader reader) { int version = reader.ReadInt(); switch (version) { case 2: { m_Treasury = reader.ReadInt(); m_TaxRate = reader.ReadDouble(); goto case 1; } case 1: { m_UnassignedGuardSlots = reader.ReadInt(); goto case 0; } case 0: { m_City = (KinFactionCities)reader.ReadInt(); m_ControlingKin = (IOBAlignment)reader.ReadInt(); m_CaptureTime = reader.ReadDeltaTime(); m_CityLeader = (PlayerMobile)reader.ReadMobile(); m_IsVotingStage = reader.ReadBool(); m_Sigil = (KinSigil)reader.ReadItem(); m_ControlPoints = reader.ReadInt(); m_ControlPointDelta = reader.ReadInt(); m_NPCFlags = (NPCFlags)reader.ReadInt(); m_GuardOption = (GuardOptions)reader.ReadInt(); m_LastGuardChangeTime = reader.ReadDeltaTime(); int length = reader.ReadInt(); if (length > 0) { for (int i = 0; i < length; ++i) { m_BeneficiaryDataList.Add(new BeneficiaryData(reader)); } } break; } } }
public BaseClothing(int itemID, Layer layer, int hue) : base(itemID) { Layer = layer; Hue = hue; m_Quality = ClothingQuality.Regular; m_MagicType = MagicEffect.None; m_MagicCharges = 0; m_Identified = true; m_IOBAlignment = IOBAlignment.None; //Pigpen - Addition for IOB System m_InvisTimer = null; m_StatEffectTimer = null; m_Dyable = true; //Froste - Addition for dye control m_Scissorable = true; // Adam - Addition for better Scissor control // erl: added for clothing wear m_HitPoints = m_MaxHitPoints = (short)Utility.RandomMinMax(InitMinHits, InitMaxHits); }
//returns the description string for the alignment public static string GetIOBName(IOBAlignment a) { string name = ""; switch (a) { case IOBAlignment.Brigand: name = "Brigands"; break; case IOBAlignment.Council: name = "Council"; break; case IOBAlignment.Good: name = "Britannian Militia"; break; case IOBAlignment.None: name = "Unaligned"; break; case IOBAlignment.Orcish: name = "Orcs"; break; case IOBAlignment.Pirate: name = "Pirates"; break; case IOBAlignment.Savage: name = "Savages"; break; case IOBAlignment.Undead: name = "Undead"; break; default: name = a.ToString(); break; } return(name); }
private void DupeCustomBits(Region r) { //pla: replicate custom region if (r is CustomRegion) { RegionControl rc = (r as CustomRegion).GetRegionControler(); if (rc != null) { //copy all the flags and restricted stuff this.m_Flags = rc.m_Flags; this.m_RestrictedSpells = new BitArray(rc.m_RestrictedSpells); this.m_RestrictedSkills = new BitArray(rc.m_RestrictedSkills); this.m_RestrictedMagicMsg = rc.m_RestrictedMagicMsg; this.m_InnLogoutDelay = rc.InnLogoutDelay; this.m_IOBAlignment = rc.IOBAlign; this.m_MaxFollowers = rc.MaxFollowerSlots; this.m_Music = r.Music; this.SetFlag(RegionFlag.Music, (r.Music != MusicName.Invalid)); if (rc.LightLevel > 0) { this.m_LightLevel = rc.LightLevel; } this.m_Types.Clear(); if (rc.m_Types != null && rc.m_Types.Count > 0) { ArrayList t = rc.m_Types; for (int i = 0; i < rc.m_Types.Count; ++i) { if (t[i] is string) { this.m_Types.Add((string)t[i]); } } } } else { this.SendMessage(String.Format("Region controller for custom region '" + r.Name + "' could not be found.\n\rCustom properties and flags have not been cloned successfully")); } } }
public static IOBAlignment GetIOBStronghold(int x, int y) { IOBAlignment alignment = IOBAlignment.None; //Orc : yew fort + ~3 screens if (x >= 557 && y >= 1424 && x < 736 && y < 1553) { alignment = IOBAlignment.Orcish; } //Savage : all 4 buildings + 1 screen if (x >= 918 && y >= 664 && x < 1041 && y < 849) { alignment = IOBAlignment.Savage; } //Pirate : all of buc's island if (x >= 2557 && y >= 1933 && x < 2883 && y < 2362) { alignment = IOBAlignment.Pirate; } //Brigand : all of serp's island if (x >= 2761 && y >= 3329 && x < 3081 && y < 3632) { alignment = IOBAlignment.Brigand; } //Council : all of Wind dungeon if (x >= 5120 && y >= 7 && x < 5368 && y < 254) { alignment = IOBAlignment.Council; } //undead : all of deceit if (x >= 5122 && y >= 518 && x < 5370 && y < 770) { alignment = IOBAlignment.Undead; } return(alignment); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 1: { goto case 0; } case 0: { m_Lifted = reader.ReadItemList(); m_IOBAlignment = (IOBAlignment)reader.ReadInt(); break; } } }
//returns the description string for the alignment public static string GetIOBName( IOBAlignment a ) { string name = ""; switch( a ) { case IOBAlignment.Brigand: name = "Brigands"; break; case IOBAlignment.Council: name = "Council"; break; case IOBAlignment.Good: name = "Britannian Militia"; break; case IOBAlignment.None: name = "Unaligned"; break; case IOBAlignment.Orcish: name = "Orcs"; break; case IOBAlignment.Pirate: name = "Pirates"; break; case IOBAlignment.Savage: name = "Savages"; break; case IOBAlignment.Undead: name = "Undead"; break; default: name = a.ToString(); break; } return name; }
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(); }
public LeftLeg(IOBAlignment iob) : this() { m_IOBAlignment = iob; }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 9: { // erl - added to handle packing out of PlayerConstructed property goto case 8; } case 8: { // removed all AOS attributes goto case 7; } case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.IOBAlignment ) ) m_IOBAlignment = (IOBAlignment)reader.ReadEncodedInt(); // obsolete AOS attributes from version 8 on if (version < 8) { AosAttributes dmy_AosAttributes; AosArmorAttributes dmy_AosArmorAttributes; if ( GetSaveFlag( flags, SaveFlag.Attributes ) ) dmy_AosAttributes = new AosAttributes( this, reader ); //else //dmy_AosAttributes = new AosAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) ) dmy_AosArmorAttributes = new AosArmorAttributes( this, reader ); //else //dmy_AosArmorAttributes = new AosArmorAttributes( this ); // read and throw away int foox; if ( GetSaveFlag( flags, SaveFlag.PhysicalBonus ) ) foox = reader.ReadEncodedInt(); // m_PhysicalBonus if ( GetSaveFlag( flags, SaveFlag.FireBonus ) ) foox = reader.ReadEncodedInt(); // m_FireBonus if ( GetSaveFlag( flags, SaveFlag.ColdBonus ) ) foox = reader.ReadEncodedInt(); // m_ColdBonus if ( GetSaveFlag( flags, SaveFlag.PoisonBonus ) ) foox = reader.ReadEncodedInt(); // m_PoisonBonus if ( GetSaveFlag( flags, SaveFlag.EnergyBonus ) ) foox = reader.ReadEncodedInt(); // m_EnergyBonus } if ( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 7 || reader.ReadBool() ); if ( GetSaveFlag( flags, SaveFlag.MaxHitPoints ) ) m_MaxHitPoints = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.HitPoints ) ) m_HitPoints = reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) m_Crafter = reader.ReadMobile(); if ( GetSaveFlag( flags, SaveFlag.Quality ) ) m_Quality = (ArmorQuality)reader.ReadEncodedInt(); else m_Quality = ArmorQuality.Regular; if ( version == 5 && m_Quality == ArmorQuality.Low ) m_Quality = ArmorQuality.Regular; if ( GetSaveFlag( flags, SaveFlag.Durability ) ) m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.Protection ) ) m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt(); if ( GetSaveFlag( flags, SaveFlag.Resource ) ) m_Resource = (CraftResource)reader.ReadEncodedInt(); else m_Resource = DefaultResource; if ( m_Resource == CraftResource.None ) m_Resource = DefaultResource; if ( GetSaveFlag( flags, SaveFlag.BaseArmor ) ) m_ArmorBase = reader.ReadEncodedInt(); else m_ArmorBase = -1; if ( GetSaveFlag( flags, SaveFlag.StrBonus ) ) m_StrBonus = reader.ReadEncodedInt(); else m_StrBonus = -1; if ( GetSaveFlag( flags, SaveFlag.DexBonus ) ) m_DexBonus = reader.ReadEncodedInt(); else m_DexBonus = -1; if ( GetSaveFlag( flags, SaveFlag.IntBonus ) ) m_IntBonus = reader.ReadEncodedInt(); else m_IntBonus = -1; if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadEncodedInt(); else m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadEncodedInt(); else m_DexReq = -1; if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadEncodedInt(); else m_IntReq = -1; if ( GetSaveFlag( flags, SaveFlag.MedAllowance ) ) m_Meditate = (AMA)reader.ReadEncodedInt(); else m_Meditate = (AMA)(-1); // obsolete AOS attributes from version 8 on if (version < 8) { AosSkillBonuses dmy_AosSkillBonuses; if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) dmy_AosSkillBonuses = new AosSkillBonuses( this, reader ); } // obsolete PlayerConstructed property from version 9 on if (version < 9) { if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) PlayerCrafted = true; } break; } case 4: { // obsolete AosAttributes dmy_AosAttributes; AosArmorAttributes dmy_AosArmorAttributes; dmy_AosAttributes = new AosAttributes( this, reader ); dmy_AosArmorAttributes = new AosArmorAttributes( this, reader ); goto case 3; } case 3: { int dummy; dummy = reader.ReadInt(); dummy = reader.ReadInt(); dummy = reader.ReadInt(); dummy = reader.ReadInt(); dummy = reader.ReadInt(); goto case 2; } case 2: case 1: { m_Identified = reader.ReadBool(); goto case 0; } case 0: { m_ArmorBase = reader.ReadInt(); m_MaxHitPoints = reader.ReadInt(); m_HitPoints = reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Quality = (ArmorQuality)reader.ReadInt(); m_Durability = (ArmorDurabilityLevel)reader.ReadInt(); m_Protection = (ArmorProtectionLevel)reader.ReadInt(); AMT mat = (AMT)reader.ReadInt(); if ( m_ArmorBase == RevertArmorBase ) m_ArmorBase = -1; /*m_BodyPos = (ArmorBodyType)*/reader.ReadInt(); if ( version < 4 ) { // Adam: (Leave for Adam to remove) //m_AosAttributes = new AosAttributes( this ); //m_AosArmorAttributes = new AosArmorAttributes( this ); } if ( version < 3 && m_Quality == ArmorQuality.Exceptional ) DistributeBonuses( 6 ); if ( version >= 2 ) { m_Resource = (CraftResource)reader.ReadInt(); } else { OreInfo info; switch ( reader.ReadInt() ) { default: case 0: info = OreInfo.Iron; break; case 1: info = OreInfo.DullCopper; break; case 2: info = OreInfo.ShadowIron; break; case 3: info = OreInfo.Copper; break; case 4: info = OreInfo.Bronze; break; case 5: info = OreInfo.Gold; break; case 6: info = OreInfo.Agapite; break; case 7: info = OreInfo.Verite; break; case 8: info = OreInfo.Valorite; break; } m_Resource = CraftResources.GetFromOreInfo( info, mat ); } m_StrBonus = reader.ReadInt(); m_DexBonus = reader.ReadInt(); m_IntBonus = reader.ReadInt(); m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); if ( m_StrBonus == OldStrBonus ) m_StrBonus = -1; if ( m_DexBonus == OldDexBonus ) m_DexBonus = -1; if ( m_IntBonus == OldIntBonus ) m_IntBonus = -1; if ( m_StrReq == OldStrReq ) m_StrReq = -1; if ( m_DexReq == OldDexReq ) m_DexReq = -1; if ( m_IntReq == OldIntReq ) m_IntReq = -1; m_Meditate = (AMA)reader.ReadInt(); if ( m_Meditate == OldMedAllowance ) m_Meditate = (AMA)(-1); if ( m_Resource == CraftResource.None ) { if ( mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather ) m_Resource = CraftResource.RegularLeather; else if ( mat == ArmorMaterialType.Spined ) m_Resource = CraftResource.SpinedLeather; else if ( mat == ArmorMaterialType.Horned ) m_Resource = CraftResource.HornedLeather; else if ( mat == ArmorMaterialType.Barbed ) m_Resource = CraftResource.BarbedLeather; else m_Resource = CraftResource.Iron; } if ( m_MaxHitPoints == 0 && m_HitPoints == 0 ) m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); break; } } //if ( m_AosSkillBonuses == null ) //m_AosSkillBonuses = new AosSkillBonuses( this ); /* if ( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo( (Mobile)Parent ); */ if (Parent is Mobile) { ((Mobile)Parent).StatChange += new StatChangeHandler(ApplyStatBonuses); ApplyStatBonuses(Parent as Mobile, StatType.All); } if ( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); // erl: PlayerConstructed is now obsolete, replaced with PlayerCrafted at item level // .. // if ( version < 7 ) // m_PlayerConstructed = true; // we don't know, so, assume it's crafted // .. }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 8: //erl - added to handle packing out of PlayerConstructed property { goto case 7; } case 7: //erl - added for clothing wear { m_HitPoints = reader.ReadShort(); m_MaxHitPoints = reader.ReadShort(); goto case 6; } case 6: //Adam - Addition for Scissorable attribute { m_Scissorable = reader.ReadBool(); goto case 5; } case 5: //Adam - Addition for Dyable attribute { m_Dyable = reader.ReadBool(); goto case 4; } case 4: //Pigpen - Addition for IOB System { m_IOBAlignment = (IOBAlignment)reader.ReadInt(); goto case 3; } case 3: { m_MagicType = (MagicEffect)reader.ReadInt(); m_MagicCharges = reader.ReadInt(); m_Identified = reader.ReadBool(); goto case 2; } case 2: { // erl: this is the old PlayerConstructed flag, which will no longer // exist for anything over version 7... made obsolete by PlayerCrafted if( version < 8 ) PlayerCrafted = reader.ReadBool(); goto case 1; } case 1: { m_Crafter = reader.ReadMobile(); m_Quality = (ClothingQuality)reader.ReadInt(); break; } case 0: { m_Crafter = null; m_Quality = ClothingQuality.Regular; break; } } if (version < 5) // Adam - addition for dye control { // Allow for other non-dyable clothes outside the IOB system if (m_IOBAlignment != IOBAlignment.None) m_Dyable = false; } if (version < 7) { // erl: this pre-dates hit point additions, so calculate values // .. // Check the quality of the piece. If it's exceptional or low, we want // the piece's hitpoint to reflect this int iMax = InitMaxHits; int iMin = InitMinHits; if( Quality == ClothingQuality.Exceptional ) { // Add 50% to both iMax = ( iMax * 3 ) / 2; // Fixed order of precedence bug iMin = ( iMin * 3 ) / 2; } else if(Quality == ClothingQuality.Low ) { // Lose 20% to both iMax = ( iMax * 4) / 5; // Fixed order of precedence bug iMin = ( iMin * 4) / 5; } m_HitPoints = m_MaxHitPoints = (short) Utility.RandomMinMax( iMin, iMax ); } // adam: To keep players from farming new characters for newbie clothes // we are moving this valuable resource into the hands of crafters. if (version <= 7) { if( Quality == ClothingQuality.Exceptional && MagicCharges == 0 ) { // make exceptional clothes newbied LootType = LootType.Newbied; } else if( MagicCharges > 0 ) { // erl: explicitly change these pieces so they aren't newbied LootType = LootType.Regular; } } }
public RightLeg(IOBAlignment iob) : this() { m_IOBAlignment = iob; }
public override void OnGuildChange( Server.Guilds.BaseGuild oldGuild ) { InvalidateMyRunUO(); m_LastGuildChange = DateTime.Now; Guilds.Guild og = oldGuild as Guilds.Guild; if( og != null ) { m_LastGuildIOBAlignment = og.IOBAlignment; } else { m_LastGuildIOBAlignment = IOBAlignment.None; } base.OnGuildChange( oldGuild ); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch (version) { case 2: { int itemCount = reader.ReadInt32(); m_spawners = new ArrayList(itemCount); for (int i = 0; i < itemCount; ++i) { Item item = reader.ReadItem(); if (item != null) m_spawners.Add(item); } goto case 1; } case 1: { m_KinRansomChest = reader.ReadItem() as KinRansomChest; m_RegStone = reader.ReadItem() as RegionControl; m_OldGuardMode = reader.ReadBool(); m_OldCountMode = reader.ReadBool(); m_RegionName = reader.ReadString(); m_IOBAlignment = (IOBAlignment)reader.ReadInt(); m_ChestOpenTime = reader.ReadDateTime(); m_bChestOpenInit = reader.ReadBool(); m_PreEventTime = reader.ReadDateTime(); m_bPreEventInit = reader.ReadBool(); goto case 0; } case 0: { // all done break; } } }
public static int MobileNotoriety(Mobile source, Mobile target) { #region Sanity // adam: sanity if (source == null || target == null) { if (source == null) { Console.WriteLine("(source == null) in Notoriety::MobileNotoriety"); } if (target == null) { Console.WriteLine("(target == null) in Notoriety::MobileNotoriety"); } //return; } #endregion if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)) { return(Notoriety.Invulnerable); } if (target.AccessLevel > AccessLevel.Player && target.AccessLevel != AccessLevel.Ignore) { return(Notoriety.CanBeAttacked); } #region Duel /* * //Begin Challenge Duel Additions * if (target is PlayerMobile && source is PlayerMobile) * { * bool tc = ((PlayerMobile)target).IsInChallenge; * bool sc = (((PlayerMobile)source).IsInChallenge); * if (tc && sc) //both in challenge * { * foreach (Item c in Challenge.Challenge.WorldStones) * { * ChallengeStone cs = c as ChallengeStone; * if (cs.OpponentTeam.Contains(target) || cs.ChallengeTeam.Contains(target)) * { * if (cs.OpponentTeam.Contains(source) || cs.ChallengeTeam.Contains(source)) * { * return Notoriety.CanBeAttacked; * } * } * } * } * } * //End Challenge Duel Additions */ #endregion // it's a pet if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature) { BaseCreature bc = (BaseCreature)target; Mobile master = bc.GetMaster(); if (master != null && master.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } if (Core.OldEthics) { Ethics.Ethic srcEthic = Ethics.Ethic.Find(source); Ethics.Ethic trgEthic = Ethics.Ethic.Find(target, true); // outside of town: evil's the target: evil's are red if (trgEthic != null && trgEthic == Ethics.Ethic.Evil && !target.Region.IsGuarded && target.Map == Map.Felucca) { return(Notoriety.Murderer); } // a fallen hero will flag gray and not enemy – this is per the original docs else if (srcEthic == Ethics.Ethic.Evil && target.CheckState(Mobile.ExpirationFlagID.FallenHero)) { return(Notoriety.CanBeAttacked); } // An innocent that attacks an evil (evil noto) will be attackable by all evils for two minutes else if (srcEthic == Ethics.Ethic.Evil && target.CheckState(Mobile.ExpirationFlagID.EvilNoto)) { return(Notoriety.CanBeAttacked); } // Hero/Evil always at war else if (srcEthic != null && trgEthic != null && srcEthic != trgEthic) { return(Notoriety.Enemy); } } } if (target.Murderer || (target.Body.IsMonster && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead))) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if ((sourceGuild != null && targetGuild != null) && (sourceGuild.Peaceful == false && targetGuild.Peaceful == false)) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) { return(Notoriety.Ally); } else if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } #region Fightbroker //If both are registered with the fightbroker, they can both attack each other if (FightBroker.IsAlreadyRegistered(source) && FightBroker.IsAlreadyRegistered(target) && (source != target)) { return(Notoriety.Enemy); } //If the source is registered on the fightbroker and the target is an interferer, make the target fair game if (FightBroker.IsAlreadyRegistered(source) && FightBroker.IsHealerInterferer(target) && (source != target)) { return(Notoriety.CanBeAttacked); } //Now handle pets of the people registered with the fightbroker if (source is BaseCreature && target is BaseCreature) { BaseCreature src = (BaseCreature)source; BaseCreature tgt = (BaseCreature)target; if (src.ControlMaster != null && tgt.ControlMaster != null) { if (FightBroker.IsAlreadyRegistered(src.ControlMaster) && FightBroker.IsAlreadyRegistered(tgt.ControlMaster) && (src.ControlMaster != tgt.ControlMaster)) { return(Notoriety.Enemy); } } } else if (source is PlayerMobile && target is BaseCreature) { BaseCreature tgt = (BaseCreature)target; if (tgt.ControlMaster != null) { if (FightBroker.IsAlreadyRegistered(source) && FightBroker.IsAlreadyRegistered(tgt.ControlMaster) && (source != tgt.ControlMaster)) { return(Notoriety.Enemy); } } } else if (source is BaseCreature && target is PlayerMobile) { BaseCreature src = (BaseCreature)source; if (src.ControlMaster != null) { if (FightBroker.IsAlreadyRegistered(target) && FightBroker.IsAlreadyRegistered(src.ControlMaster) && (target != src.ControlMaster)) { return(Notoriety.Enemy); } } } //done with pets/fightbroker status #endregion #region Kin //Now handle IOB status hueing if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.IOBShardWide) || (Server.Engines.IOBSystem.IOBRegions.IsInIOBRegion(source) && Server.Engines.IOBSystem.IOBRegions.IsInIOBRegion(target))) { IOBAlignment srcIOBAlignment = IOBAlignment.None; IOBAlignment trgIOBAlignment = IOBAlignment.None; if (source is BaseCreature) { srcIOBAlignment = ((BaseCreature)source).IOBAlignment; } else if (source is PlayerMobile) { srcIOBAlignment = ((PlayerMobile)source).IOBAlignment; } if (target is BaseCreature) { trgIOBAlignment = ((BaseCreature)target).IOBAlignment; } else if (target is PlayerMobile) { trgIOBAlignment = ((PlayerMobile)target).IOBAlignment; } if (srcIOBAlignment != IOBAlignment.None && trgIOBAlignment != IOBAlignment.None && srcIOBAlignment != IOBAlignment.Healer ) { //If they're different alignments OR target is OutCast, then they're an enemy //Pix 12/3/07: added healer target //Pix: 12/4/07 - now kin-healers flag canbeattacked to kin instead of enemy if (trgIOBAlignment == IOBAlignment.Healer) { return(Notoriety.CanBeAttacked); } else if (srcIOBAlignment != trgIOBAlignment || trgIOBAlignment == IOBAlignment.OutCast) { return(Notoriety.Enemy); } else { if (source is PlayerMobile && target is BaseCreature) { return(Notoriety.Ally); } else { //Pix: 4/28/06 - removed Ally notoriety of same-aligned kin - // this is now handled by guilds via allying //return Notoriety.Ally; } } } //if we're looking at ourselves, and we're a KinHealer, show ourself as enemy if (source == target && srcIOBAlignment == IOBAlignment.Healer) { return(Notoriety.Enemy); } } //done with IOB status hueing if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.IOBFollower) { return(Notoriety.CanBeAttacked); } } #endregion Faction srcFaction = Faction.Find(source, true, true); Faction trgFaction = Faction.Find(target, true, true); if (srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet) { return(Notoriety.Enemy); } if (Core.OldEthics) { Ethics.Ethic srcEthic = Ethics.Ethic.Find(source); Ethics.Ethic trgEthic = Ethics.Ethic.Find(target); // outside of town: evil's the target: evil's are red if (trgEthic != null && trgEthic == Ethics.Ethic.Evil && !target.Region.IsGuarded && target.Map == Map.Felucca) { return(Notoriety.Murderer); } // a fallen hero will flag gray and not enemy – this is per the original docs else if (srcEthic == Ethics.Ethic.Evil && target.CheckState(Mobile.ExpirationFlagID.FallenHero)) { return(Notoriety.CanBeAttacked); } // An innocent that attacks an evil (evil noto) will be attackable by all evils for two minutes else if (srcEthic == Ethics.Ethic.Evil && target.CheckState(Mobile.ExpirationFlagID.EvilNoto)) { return(Notoriety.CanBeAttacked); } // Hero/Evil always at war else if (srcEthic != null && trgEthic != null && srcEthic != trgEthic) { return(Notoriety.Enemy); } } if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent)) { if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !TransformationSpellHelper.UnderTransformation(target) /*&& !AnimalForm.UnderTransformation(target) Ninja stuff*/) { return(Notoriety.CanBeAttacked); } } if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source) { return(Notoriety.CanBeAttacked); } } if (source is BaseCreature) { BaseCreature bc = (BaseCreature)source; Mobile master = bc.GetMaster(); if (master != null && CheckAggressor(master.Aggressors, target)) { return(Notoriety.CanBeAttacked); } } return(Notoriety.Innocent); }
private string TranslateIOBName(IOBAlignment iob) { return Engines.IOBSystem.IOBSystem.GetIOBName( iob ); }
public override void Deserialize(GenericReader reader) { int version = reader.ReadInt(); switch (version) { case 8: { m_Flags = (GuildFlags)reader.ReadInt(); goto case 7; } case 7: { m_bGuildWarRing = reader.ReadBool(); goto case 6; } case 6: { m_TownshipStone = reader.ReadItem(); goto case 5; } case 5: { m_IOBAlignment = (IOBAlignment)reader.ReadInt(); goto case 4; } case 4: { m_AllyDeclarations = reader.ReadGuildList(); m_AllyInvitations = reader.ReadGuildList(); goto case 3; } case 3: { m_TypeLastChange = reader.ReadDateTime(); goto case 2; } case 2: { m_Type = (GuildType)reader.ReadInt(); goto case 1; } case 1: { m_LastFealty = reader.ReadDateTime(); goto case 0; } case 0: { m_Leader = reader.ReadMobile(); m_Name = reader.ReadString(); m_Abbreviation = reader.ReadString(); m_Allies = reader.ReadGuildList(); m_Enemies = reader.ReadGuildList(); m_WarDeclarations = reader.ReadGuildList(); m_WarInvitations = reader.ReadGuildList(); m_Members = reader.ReadMobileList(); m_Candidates = reader.ReadMobileList(); m_Accepted = reader.ReadMobileList(); m_Guildstone = reader.ReadItem(); m_Teleporter = reader.ReadItem(); m_Charter = reader.ReadString(); m_Website = reader.ReadString(); break; } } if (m_AllyDeclarations == null) { m_AllyDeclarations = new ArrayList(); } if (m_AllyInvitations == null) { m_AllyInvitations = new ArrayList(); } if (m_Guildstone == null || m_Members.Count == 0) { Disband(); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); // version m_SaveFlags = ReadSaveFlags(reader, version); // always follows version /* begin normal Deserialize here */ switch (version) { case 10: { if (GetFlag(SaveFlags.HasOBAlignment)) { m_IOBAlignment = (IOBAlignment)reader.ReadInt(); } goto case 9; } case 9: { m_Owner = reader.ReadMobile(); goto case 8; } case 8: { m_Trapper = reader.ReadMobile(); goto case 7; } case 7: { m_TrapLevel = reader.ReadInt(); goto case 6; } case 6: { m_OldTrapPower = reader.ReadInt(); goto case 5; } case 5: { goto case 4; } case 4: { m_Enabled = reader.ReadBool(); goto case 3; } case 3: { if (version < 5) { reader.ReadBool(); // deco field } goto case 2; } case 2: { if (version <= 7) { reader.ReadBool(); // m_TinkerMade } m_OldTrapType = (TrapType)reader.ReadInt(); goto case 1; } case 1: { m_TrapPower = reader.ReadInt(); if (version < 6) { m_OldTrapPower = m_TrapPower; } goto case 0; } case 0: { m_TrapType = (TrapType)reader.ReadInt(); break; } } if (version < 7) { // I guess this is reasonable // Example: a level 5 trap is TrapPower 5*25, and the TrapLevel is 5 // therfore a reasonable m_TrapLevel is TrapPower / 25 m_TrapLevel = TrapPower / 25; } }
public override void Deserialize(GenericReader reader) { int version = reader.ReadInt(); switch (version) { case 8: { m_Flags = (GuildFlags)reader.ReadInt(); goto case 7; } case 7: { m_bGuildWarRing = reader.ReadBool(); goto case 6; } case 6: { m_TownshipStone = reader.ReadItem(); goto case 5; } case 5: { m_IOBAlignment = (IOBAlignment)reader.ReadInt(); goto case 4; } case 4: { m_AllyDeclarations = reader.ReadGuildList(); m_AllyInvitations = reader.ReadGuildList(); goto case 3; } case 3: { m_TypeLastChange = reader.ReadDateTime(); goto case 2; } case 2: { m_Type = (GuildType)reader.ReadInt(); goto case 1; } case 1: { m_LastFealty = reader.ReadDateTime(); goto case 0; } case 0: { m_Leader = reader.ReadMobile(); m_Name = reader.ReadString(); m_Abbreviation = reader.ReadString(); m_Allies = reader.ReadGuildList(); m_Enemies = reader.ReadGuildList(); m_WarDeclarations = reader.ReadGuildList(); m_WarInvitations = reader.ReadGuildList(); m_Members = reader.ReadMobileList(); m_Candidates = reader.ReadMobileList(); m_Accepted = reader.ReadMobileList(); m_Guildstone = reader.ReadItem(); m_Teleporter = reader.ReadItem(); m_Charter = reader.ReadString(); m_Website = reader.ReadString(); break; } } if (m_AllyDeclarations == null) m_AllyDeclarations = new ArrayList(); if (m_AllyInvitations == null) m_AllyInvitations = new ArrayList(); if (m_Guildstone == null || m_Members.Count == 0) Disband(); }
public BaseArmor( int itemID ) : base( itemID ) { m_Quality = ArmorQuality.Regular; m_Durability = ArmorDurabilityLevel.Regular; m_Crafter = null; m_IOBAlignment = IOBAlignment.None; //Pigpen - Addition for IOB System m_Resource = DefaultResource; Hue = CraftResources.GetHue( m_Resource ); m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits ); this.Layer = (Layer)ItemData.Quality; // Adam: obsolete //m_AosAttributes = new AosAttributes( this ); //m_AosArmorAttributes = new AosArmorAttributes( this ); //m_AosSkillBonuses = new AosSkillBonuses( this ); }
/// <summary> /// Get and save all the all the quest variables. /// We will use this information for the pre event announcements, and the event setup /// when the event starts. /// </summary> public void OnPreEventInit() { // find the ransom chests ArrayList list = new ArrayList(); foreach (Item ix in World.Items.Values) if (ix is KinRansomChest) list.Add(ix); // process the list of chests if (list.Count > 0) { // select a chest at random m_KinRansomChest = list[Utility.Random(list.Count)] as KinRansomChest; if ( m_KinRansomChest != null ) { // save the alignment m_IOBAlignment = m_KinRansomChest.IOBAlignment; // turn off alignment changing during event (and 24 hour warning) CoreAI.SetDynamicFeature( CoreAI.FeatureBits.GuildKinChangeDisabled ); // turn off guards from this custom regions CustomRegion reg = Region.Find( m_KinRansomChest.Location, m_KinRansomChest.Map ) as CustomRegion; if( reg != null ) { try { // if a custom region does exsist find its controller m_RegStone = reg.GetRegionControler(); if (m_RegStone != null ) { m_RegionName = m_RegStone.RegionName; } } catch(NullReferenceException e) { LogHelper.LogException(e); Console.WriteLine("Caught exception: {0} ", e.Message); } catch(Exception ex) { LogHelper.LogException(ex); Console.WriteLine("Caught exception:", ex.Message); } } // 11/21/06 Pla: Add the chest region to the no camp zones! Rectangle2D rect = GetChestArea(); if (rect.X != 0 && rect.Y != 0 ) CampHelper.AddRestrictedArea(rect); } } else { Console.WriteLine("KinRansomAES: No Ransom chests found, aborting event.."); // tell our base class to stop processing. // the base will also begin cleanup ValidState = false; } Console.WriteLine("KinRansomAES: Pre Event setup."); }
public Torso(IOBAlignment iob) : this() { m_IOBAlignment = iob; }
/// <summary> /// Called when the vortex is sucessfully killed /// All the points calculation and processing happens here /// </summary> public void VortexDeath() { CaptureData logData = new CaptureData(); logData.City = m_City.ToString(); logData.CaptureTime = DateTime.Now; logData.LogTime = DateTime.Now; //turn off expire timer if (m_Timer != null && m_Timer.Running) { m_Timer.Stop(); } if (KinSystemSettings.OutputCaptureData) { SendMessageToLocalGM(string.Format("Vortex for the city of {0} has been destroyed", m_City.ToString())); } Dictionary <PlayerMobile, double> individualCapturePoints //dual purpose damage dictionary and capture points = new Dictionary <PlayerMobile, double>(); Dictionary <IOBAlignment, int> kinDamageSpread //kin damage spread dictionary = new Dictionary <IOBAlignment, int>(); KinCapturePointList kinCapturePoints = new KinCapturePointList(); //final kin capture point list KinCapturePointList finalCapturePoints = new KinCapturePointList(); //final individual capture point list IOBAlignment winningKin = IOBAlignment.None; //Winning kin double capturePointsPerVortexDamage = 0.0; //Standardised capture points per vortex damage point double capturePointsPerDefensePoint = 0.0; //Standardised capture points per defense point double totalCapturePoints = 0.0; //total capture points int totalVortexDamage = 0; //total vortex damage //First, cycle thru the vortex's damage list and populate individual and kin damage dictionaries foreach (DamageEntry de in m_Vortex.DamageEntries) { PlayerMobile pm = null; //Check this is a real factioner or a factioner's pet if (de.Damager is PlayerMobile && ((PlayerMobile)de.Damager).IsRealFactioner) { pm = ((PlayerMobile)de.Damager); } else if (de.Damager is BaseCreature) { BaseCreature bc = ((BaseCreature)de.Damager); if (bc.ControlMaster != null && bc.ControlMaster is PlayerMobile && ((PlayerMobile)bc.ControlMaster).IsRealFactioner) { pm = ((PlayerMobile)bc.ControlMaster); } else if (bc.Summoned && bc.SummonMaster != null && bc.SummonMaster is PlayerMobile && ((PlayerMobile)bc.SummonMaster).IsRealFactioner) { pm = ((PlayerMobile)bc.SummonMaster); } } if (pm == null) { continue; } //add this player and the damage to the dictionary, to be converted into capture points in the next stage if (individualCapturePoints.ContainsKey(pm)) { individualCapturePoints[pm] += de.DamageGiven; } else { individualCapturePoints.Add(pm, de.DamageGiven); } //keep running total of all damage totalVortexDamage += de.DamageGiven; //also add this damage to the kin dictionary for later if (!kinDamageSpread.ContainsKey(pm.IOBRealAlignment)) { kinDamageSpread.Add(pm.IOBRealAlignment, de.DamageGiven); } else { kinDamageSpread[pm.IOBRealAlignment] += de.DamageGiven; } } //add anyone else from the defense points into the damage list, with 0 damage foreach (PlayerMobile pm in m_DefensePoints.Keys) { if (!individualCapturePoints.ContainsKey(pm)) { individualCapturePoints.Add(pm, 0.0); } } //add up defense points, this will act as the total amount of capture points avaliable foreach (KeyValuePair <PlayerMobile, double> pair in m_DefensePoints) { totalCapturePoints += pair.Value; } //Make sure we have at least 1 capture point to work with if (totalCapturePoints == 0) { totalCapturePoints = 1; } //standardise each damage point of the vortex damage so the vortex is worth KinSystemSettings % of the points capturePointsPerVortexDamage = ((totalCapturePoints * KinSystemSettings.VortexCaptureProportion) / totalVortexDamage); //the remainder contributes to defenders capturePointsPerDefensePoint = ((totalCapturePoints * (1.0 - KinSystemSettings.VortexCaptureProportion) / totalCapturePoints)); //output data thus far to local GM's journal if (KinSystemSettings.OutputCaptureData) { //Individual damage SendMessageToLocalGM("Individual damage to vortex:"); foreach (KeyValuePair <PlayerMobile, double> kvp in individualCapturePoints) { Player p = new Player(kvp.Key); p.Value = kvp.Value; logData.IndividualVortexDamage.Add(p); SendMessageToLocalGM(string.Format("Player {0} inflicted {1} points of damage", kvp.Key.Name, kvp.Value)); } //Total damage SendMessageToLocalGM(string.Format("Total damage inflicted on vortex: {0}", totalVortexDamage)); logData.TotalVortexDamage = totalVortexDamage; //Damage split by Kin SendMessageToLocalGM("Kin damage to vortex:"); foreach (KeyValuePair <IOBAlignment, int> kvp in kinDamageSpread) { StringDoublePair k = new StringDoublePair(); k.Name = kvp.Key.ToString(); k.Value = kvp.Value; logData.KinDamageSpread.Add(k); SendMessageToLocalGM(string.Format("Kin {0} inflicted {1} points of damage", kvp.Key.ToString(), kvp.Value)); } //Individual defense points SendMessageToLocalGM("Individual defense points earnt:"); foreach (KeyValuePair <PlayerMobile, double> kvp in m_DefensePoints) { Player p = new Player(kvp.Key); p.Value = kvp.Value; logData.IndividualDefensePoints.Add(p); SendMessageToLocalGM(string.Format("Player {0} earnt {1} defense points", kvp.Key.Name, kvp.Value)); } //Total defense points SendMessageToLocalGM(string.Format("Total defense (capture) points earnt: {0}", totalCapturePoints)); logData.TotalCapturePoints = totalCapturePoints; //Calculated points SendMessageToLocalGM(string.Format("Capture points per vortex damage : {0}", capturePointsPerVortexDamage)); SendMessageToLocalGM(string.Format("Capture points per defense point : {0}", capturePointsPerDefensePoint)); } //Reformat the individual list into capture points. List <PlayerMobile> pms = new List <PlayerMobile>(); //Temp list foreach (PlayerMobile pm in individualCapturePoints.Keys) { pms.Add(pm); } foreach (PlayerMobile pm in pms) { //reformat damage points individualCapturePoints[pm] *= capturePointsPerVortexDamage; if (m_DefensePoints.ContainsKey(pm)) { //Add any more capture points from defense individualCapturePoints[pm] += (m_DefensePoints[pm] * capturePointsPerDefensePoint); } //add this player's total capture points towards kin total kinCapturePoints.AddPoints(pm.IOBRealAlignment, individualCapturePoints[pm]); } //Free up temp list! pms.Clear(); pms = null; //Sort kin capture points (desc) kinCapturePoints.Sort(); //More output data if (KinSystemSettings.OutputCaptureData) { SendMessageToLocalGM("Total individual capture points:"); foreach (KeyValuePair <PlayerMobile, double> kvp in individualCapturePoints) { Player p = new Player(kvp.Key); p.Value = kvp.Value; logData.IndividualCapturePoints.Add(p); SendMessageToLocalGM(string.Format("Player {0} earnt {1} total capture points", kvp.Key.Name, kvp.Value)); } SendMessageToLocalGM("Total kin capture points:"); foreach (KinCapturePoints points in kinCapturePoints) { StringDoublePair k = new StringDoublePair(); k.Name = points.Obj.ToString(); k.Value = points.Points; logData.KinCapturePoints.Add(k); SendMessageToLocalGM(string.Format("Kin {0} earnt {1} total capture points", points.Obj.ToString(), points.Points)); } } //Now find a winner - but the winning kin must also have done at least x% of the vortex damage for (int i = 0; i < kinCapturePoints.Count; ++i) { IOBAlignment kin = IOBAlignment.None; if (kinCapturePoints[i].Obj is IOBAlignment) { kin = (IOBAlignment)kinCapturePoints[i].Obj; } int damage = 0; if (kinDamageSpread.ContainsKey(kin)) { damage = kinDamageSpread[kin]; } else { damage = 0; } if (damage >= (totalVortexDamage * KinSystemSettings.VortexMinDamagePercentage)) { //found our winner winningKin = kin; break; } else { if (KinSystemSettings.OutputCaptureData) { SendMessageToLocalGM(string.Format("Kin {0} would have won, but didn't do enough damage to the vortex", kin.ToString())); } } } logData.WinningKin = winningKin.ToString(); if (winningKin == IOBAlignment.None || winningKin == IOBAlignment.Healer || winningKin == IOBAlignment.OutCast) { //this shouldn't really happen. //Hand city over to golem controllers KinCityManager.TransferOwnership(m_City, IOBAlignment.None, null); } //Find and move all of this kin into the final capture point list foreach (KeyValuePair <PlayerMobile, double> pair in individualCapturePoints) { if (pair.Key.IOBRealAlignment == winningKin) { finalCapturePoints.AddPoints(pair.Key, pair.Value); } } //woo sanity if (finalCapturePoints.Count == 0) { //this should never happen. //Hand city over to golem controllers KinCityManager.TransferOwnership(m_City, IOBAlignment.None, null); } //Sort capture points list desc finalCapturePoints.Sort(); int totalBenes = 0; //now we want the top x% of this list to act as beneficiaries for the town, with a cap if (finalCapturePoints.Count < KinSystemSettings.BeneficiaryCap) { totalBenes = finalCapturePoints.Count; } else { //plasma: removing the qualification % for now, it's too inhibitive with a little amount of players. totalBenes = KinSystemSettings.BeneficiaryCap; //totalBenes = (int)Math.Round((double)finalCapturePoints.Count * KinSystemSettings.BeneficiaryQualifyPercentage, 0); //Should never happen, but possible depending on the KinSystemSettings variables if (totalBenes < 1) { totalBenes = 1; } } //Send message to winners List <PlayerMobile> winners = new List <PlayerMobile>(); for (int i = 0; i < totalBenes; ++i) { winners.Add(finalCapturePoints[i].Obj as PlayerMobile); } //Send message to all KinSystem.SendKinMessage(string.Format("The City of {0} has fallen to the {1}! ", m_City.ToString(), winningKin == IOBAlignment.None ? "Golem Controller Lord" : IOBSystem.GetIOBName(winningKin))); winners.ForEach(delegate(PlayerMobile pm) { pm.SendMessage("You have qualified as a beneficiary of {0}. Head to the city's control board to vote for a City leader.", m_City.ToString()); }); if (KinSystemSettings.OutputCaptureData) { SendMessageToLocalGM("Final beneficiaries of town:"); foreach (PlayerMobile pm in winners) { Player p = new Player(pm); logData.BeneficiariesCpaturePoints.Add(p); SendMessageToLocalGM(pm.Name); } } //Hand city over to the kin and its beneficiaries KinCityManager.TransferOwnership(m_City, winningKin, winners); m_DefensePoints.Clear(); if (KinSystemSettings.OutputCaptureData) { KinFactionLogs.Instance.AddEntityToSerialize(logData); } //Fianlly set the base next vortex spawn time for this city/sigil SetNewSpawnTime(); }
public static void SendKinMessage(IOBAlignment align, string message) { SendKinMessage(new IOBAlignment[] { align }, message); }
public override void OnResponse(NetState state, RelayInfo info) { if (GuildGump.BadLeader(m_Mobile, m_Guild)) { return; } GuildType newType = m_Guild.Type; //GuildType.Regular; IOBAlignment newIOBType = m_Guild.IOBAlignment; //IOBAlignment.None; switch (info.ButtonID) { default: break; //return; // Close case 1: newType = GuildType.Regular; break; case 2: newType = GuildType.Order; break; case 3: newType = GuildType.Chaos; break; case 5: newIOBType = IOBAlignment.Brigand; break; case 6: newIOBType = IOBAlignment.Council; break; case 7: newIOBType = IOBAlignment.Good; break; case 8: newIOBType = IOBAlignment.Orcish; break; case 9: newIOBType = IOBAlignment.Pirate; break; case 10: newIOBType = IOBAlignment.Savage; break; case 11: newIOBType = IOBAlignment.Undead; break; case 12: newIOBType = IOBAlignment.None; break; } if (m_Guild.IOBAlignment != newIOBType && CanChangeKin() == false) { m_Mobile.SendMessage("Guild Kin Alignment change is currently disabled."); return; } if ((m_Guild.Type != newType || m_Guild.IOBAlignment != newIOBType) && m_Guild.TypeLastChange.AddDays(7) > DateTime.Now) { m_Mobile.SendMessage("You can only change your alignment once every 7 days."); } else { if (m_Guild.Type != newType) { //Changing Order/Chaos //Check that Order/Chaos guilds aren't allied if (newType != GuildType.Regular) //we only care if there changeing to a differnt special type { ArrayList Allies = m_Guild.Allies; for (int i = 0; i < Allies.Count; ++i) { Guild g = (Guild)Allies[i]; if (g.Type != GuildType.Regular && g.Type != newType) { m_Mobile.SendMessage("Break any alliances with opposing guild types first"); return; } } } //Change the Guild! m_Guild.Type = newType; m_Guild.GuildMessage(1018022, newType.ToString()); // Guild Message: Your guild type has changed: } else if (m_Guild.IOBAlignment != newIOBType) { //Changing KIN //Check that different IOB types aren't allied if (newIOBType != IOBAlignment.None) { ArrayList Allies = m_Guild.Allies; for (int i = 0; i < Allies.Count; ++i) { Guild g = (Guild)Allies[i]; if (g.IOBAlignment != IOBAlignment.None && g.IOBAlignment != newIOBType) { m_Mobile.SendMessage("Break any alliances with opposing guild types first"); return; } } } //Change the Guild! m_Guild.IOBAlignment = newIOBType; if (m_Guild.IOBAlignment != IOBAlignment.None) { m_Guild.GuildMessage("Your guild is now allied with the " + this.TranslateIOBName(newIOBType)); } else { m_Guild.GuildMessage("Your guild has broken its kin alignment, it is now unaligned."); } } else { m_Mobile.SendMessage("You have not changed your alignment."); } } GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); SaveFlag saveFlags = ReadSaveBits(reader, version, 30); /////////////////////////////////////////////////// // put all normal serialization below this line /////////////////////////////////////////////////// switch ( version ) { case 32: { //Adam: v32 add mini game ID and save data. if (GetSaveFlag(saveFlags, SaveFlag.ZCodeMiniGame) == true) { m_ZCodeMiniGameID = reader.ReadInt(); // hash code of the string naming the mini game int size = reader.ReadInt(); // saved game size m_ZCodeMiniGameData = new byte[size]; // allocate a new game buffer for (int ix = 0; ix < size; ix++) m_ZCodeMiniGameData[ix] = reader.ReadByte(); // saved game } goto case 31; } case 31: { if (GetSaveFlag(saveFlags, SaveFlag.NPCGuild) == true) m_NpcGuildPoints = reader.ReadDouble(); goto case 30; } case 30: // Adam: v.30 Dummy version, removed NPCGuild vars when not needed { goto case 29; } case 29: //Pla: Dummy version, removed duel system vars { goto case 28; } case 28: //Pix: Kin Faction additions { m_KinSoloPoints = reader.ReadDouble(); m_KinTeamPoints = reader.ReadDouble(); goto case 27; } case 27: //Pix: challenge duel system { //pla: not used anymore if (version < 29) { //m_iChallengeDuelWins = reader.ReadInt(); //m_iChallengeDuelLosses = reader.ReadInt(); reader.ReadInt(); reader.ReadInt(); } goto case 26; } case 26: //Adam: ghost blindness { m_Blind = reader.ReadBool(); m_SightExpire = reader.ReadDateTime(); if (m_SightExpire != DateTime.MaxValue) { if (m_SightExpire <= DateTime.Now) Timer.DelayCall(TimeSpan.Zero, new TimerCallback(GoBlind)); else Timer.DelayCall(m_SightExpire - DateTime.Now, new TimerCallback(GoBlind)); } goto case 25; } case 25: //Pix: WatchList enhancements { m_WatchReason = reader.ReadString(); m_WatchExpire = reader.ReadDateTime(); goto case 24; } case 24: // Rhi: FilterMusic { m_FilterMusic = reader.ReadBool(); goto case 23; } case 23: // Pix: IOB System changes { m_IOBKillPoints = reader.ReadDouble(); m_LastGuildIOBAlignment = (IOBAlignment)reader.ReadInt(); m_LastGuildChange = reader.ReadDateTime(); goto case 22; } case 22: { m_Reported = reader.ReadDateTime(); if (m_Reported > DateTime.Now - ReportTime) { m_ReportLogger = new LogHelper( GetReportLogName(m_Reported.ToString("MM-dd-yyyy HH-mm-ss")), false ); m_ReportLogStopper = Timer.DelayCall(ReportTime - (DateTime.Now - m_Reported), new TimerCallback(EndReport)); } goto case 21; } case 21: { LastRegion = Region.Find( this.Location, this.Map ); goto case 20; } case 20: //Pix: Offline short count decay { m_LastShortDecayed = reader.ReadDateTime(); goto case 19; } case 19: //Pix - for IOB Ranks { m_IOBRankTime = reader.ReadTimeSpan(); goto case 18; } case 18: //Pigpen - Addition for IOB Sytem { if( version < 23 ) { //m_IOBAlignment = (IOBAlignment)reader.ReadInt(); //IOBTimer = reader.ReadTimeSpan(); reader.ReadInt(); reader.ReadTimeSpan(); } m_IOBEquipped = reader.ReadBool(); goto case 16; } case 17: // changed how DoneQuests is serialized case 16: { m_Quest = QuestSerializer.DeserializeQuest( reader ); if ( m_Quest != null ) m_Quest.From = this; int count = reader.ReadEncodedInt(); if ( count > 0 ) { m_DoneQuests = new ArrayList(); for ( int i = 0; i < count; ++i ) { Type questType = QuestSerializer.ReadType( QuestSystem.QuestTypes, reader ); DateTime restartTime; if ( version < 17 ) restartTime = DateTime.MaxValue; else restartTime = reader.ReadDateTime(); m_DoneQuests.Add( new QuestRestartInfo( questType, restartTime ) ); } } m_Profession = reader.ReadEncodedInt(); goto case 15; } case 15: { m_LastCompassionLoss = reader.ReadDeltaTime(); goto case 14; } case 14: { m_CompassionGains = reader.ReadEncodedInt(); if ( m_CompassionGains > 0 ) m_NextCompassionDay = reader.ReadDeltaTime(); goto case 13; } case 13: // just removed m_PayedInsurance list case 12: { m_BOBFilter = new Engines.BulkOrders.BOBFilter( reader ); goto case 11; } case 11: { if ( version < 13 ) { ArrayList payed = reader.ReadItemList(); // Adam: no more insurance //for ( int i = 0; i < payed.Count; ++i ) //((Item)payed[i]).PayedInsurance = true; } goto case 10; } case 10: { if ( reader.ReadBool() ) { m_HairModID = reader.ReadInt(); m_HairModHue = reader.ReadInt(); m_BeardModID = reader.ReadInt(); m_BeardModHue = reader.ReadInt(); // We cannot call SetHairMods( -1, -1 ) here because the items have not yet loaded Timer.DelayCall( TimeSpan.Zero, new TimerCallback( RevertHair ) ); } goto case 9; } case 9: { SavagePaintExpiration = reader.ReadTimeSpan(); if ( SavagePaintExpiration > TimeSpan.Zero ) { // BodyMod = ( Female ? 184 : 183 ); HueMod = 0; } goto case 8; } case 8: { if (version < 30) { m_NpcGuild = (NpcGuild)reader.ReadInt(); m_NpcGuildJoinTime = reader.ReadDateTime(); m_NpcGuildGameTime = reader.ReadTimeSpan(); } else if (GetSaveFlag(saveFlags, SaveFlag.NPCGuild) == true) { m_NpcGuild = (NpcGuild)reader.ReadInt(); m_NpcGuildJoinTime = reader.ReadDateTime(); m_NpcGuildGameTime = reader.ReadTimeSpan(); } goto case 7; } case 7: { m_PermaFlags = reader.ReadMobileList(); goto case 6; } case 6: { NextTailorBulkOrder = reader.ReadTimeSpan(); goto case 5; } case 5: { NextSmithBulkOrder = reader.ReadTimeSpan(); goto case 4; } case 4: { m_LastJusticeLoss = reader.ReadDeltaTime(); m_JusticeProtectors = reader.ReadMobileList(); goto case 3; } case 3: { m_LastSacrificeGain = reader.ReadDeltaTime(); m_LastSacrificeLoss = reader.ReadDeltaTime(); m_AvailableResurrects = reader.ReadInt(); goto case 2; } case 2: { m_Flags = (PlayerFlag)reader.ReadInt(); goto case 1; } case 1: { m_LongTermElapse = reader.ReadTimeSpan(); m_ShortTermElapse = reader.ReadTimeSpan(); m_GameTime = reader.ReadTimeSpan(); goto case 0; } case 0: { break; } } if ( m_PermaFlags == null ) m_PermaFlags = new ArrayList(); if ( m_JusticeProtectors == null ) m_JusticeProtectors = new ArrayList(); if ( m_BOBFilter == null ) m_BOBFilter = new Engines.BulkOrders.BOBFilter(); ArrayList list = this.Stabled; for ( int i = 0; i < list.Count; ++i ) { BaseCreature bc = list[i] as BaseCreature; if ( bc != null ) bc.IsStabled = true; } //Pix: this is for safety... to make sure it's set m_InmateLastDeathTime = DateTime.MinValue; //Pix: make sure this is set to minvalue for loading m_IOBStartedWearing = DateTime.MinValue; //wea: SpiritCohesion is not persistent across saves m_SpiritCohesion = 0; //wea: For spirit cohesion, last resurrect time m_LastResurrectTime = DateTime.MinValue; }
public bool OnEquippedIOBItem( IOBAlignment iobalignment ) { if ( this.IOBEquipped == false ) { this.IOBEquipped = true; } return IOBEquipped; }
/// <summary> /// Transfers owership of a city to a kin or golem controller king /// </summary> /// <param name="city"></param> /// <param name="winners"></param> public static void TransferOwnership(KinFactionCities city, IOBAlignment kin, List<PlayerMobile> winners) { KinCityData cd = GetCityData(city); if (cd == null) { Console.WriteLine("Error in KinCityManager.TransferOwnership() - City Data not found"); return; } //Set props that apply to both GC and Kin cd.CityLeader = null; cd.CaptureTime = DateTime.Now; cd.ClearAllGuardPosts(); cd.ClearActivityDelta(); if (kin == IOBAlignment.None) //GCs! { cd.ControlingKin = kin; //setup defaults for a controller city cd.IsVotingStage = false; cd.TaxRate = 0.0; cd.BeneficiaryDataList.Clear(); cd.UnassignedGuardPostSlots = 0; //Absorb treasury cd.EmptyTreasury(); ChangeGuards(city, KinCityData.GuardOptions.None, true); cd.ClearNPCFLags(); //Update townspeople spawners and switch on GCs UpdateCityNPCSpawners(cd.City); if (OnGolemController != null) { OnGolemController(cd.City, true); } } else { //check to see if the city was previously owned by the controllers if (cd.ControlingKin == IOBAlignment.None) { //if so then apply default settings for a town cd.SetAllNPCFlags(); ChangeGuards(city, KinCityData.GuardOptions.None, true); //Set last change time so they can change the guards immediately cd.LastGuardChangeTime = DateTime.Now.AddHours(-KinSystemSettings.GuardChangeTimeHours); //Update townspeople spawners and switch off GCs UpdateCityNPCSpawners(cd.City); SetGolemControllers(cd.City, false); if (OnGolemController != null) { OnGolemController(cd.City, false); } } else { cd.LastGuardChangeTime = DateTime.Now.AddHours(-KinSystemSettings.GuardChangeTimeHours); } cd.ControlingKin = kin; //Assign voting info cd.BeneficiaryDataList.Clear(); foreach (PlayerMobile pm in winners) cd.BeneficiaryDataList.Add(new KinCityData.BeneficiaryData(pm, 0)); //Change the guards to none if it is LB incase the new owners are all red if (cd.GuardOption == KinCityData.GuardOptions.LordBritish) ChangeGuards(cd.City, KinCityData.GuardOptions.None, true); //Skip voting if only one beneficiary if (cd.BeneficiaryDataList.Count == 1) { cd.CityLeader = cd.BeneficiaryDataList[0].Pm; } else { cd.IsVotingStage = true; } cd.UnassignedGuardPostSlots = KinSystem.GetCityGuardPostSlots(city); //Voting is controlled by heartbeat } }
/// <summary> /// /// </summary> /// <param name="type">Guard cost type</param> /// <param name="permission">Whether to restrict or deny access</param> /// <param name="eligibleKin">Which kins to apply the permission to. All kin have access by default. By supplying any Allow permissions will automatically restrict all other kins, and vice-versa</param> public KinFactionGuardTypeAttribute(KinFactionGuardCostTypes type, PermissionType permission, IOBAlignment[] eligibleKin ) { m_Type = type; if (eligibleKin != null) { if (permission == PermissionType.Allow) { m_EligibleKin.Clear(); m_EligibleKin.AddRange(eligibleKin); } else { //allow everyone but these. foreach( string current in Enum.GetNames( typeof(IOBAlignment) )) { bool found = false; foreach( IOBAlignment iob in eligibleKin ) { if( current.Equals(iob.ToString())) { found = true; break; } } if (!found) { //Add this to the list m_EligibleKin.Add((IOBAlignment)Enum.Parse(typeof(IOBAlignment), current)); } } } } }
public KinRansomChest( IOBAlignment IOBAlignment, bool bFill ) : base( 0xE41 ) { this.IOBAlignment = IOBAlignment; this.Movable = false; this.TrapType = Utility.RandomBool() ? TrapType.PoisonTrap : TrapType.ExplosionTrap; this.TrapPower = 100; this.Locked = true; this.RequiredSkill = 100; this.LockLevel = this.RequiredSkill - 10; this.MaxLockLevel = this.RequiredSkill + 40; if (bFill == true) KinRansomChest.Fill( this ); }
/// <summary> /// /// </summary> /// <param name="kin">Which kins to apply the permission to. All kin have access by default. By supplying any Allow permissions will automatically restrict all other kins, and vice-versa</param> public KinFactionGuardTypeAttribute(PermissionType permission, IOBAlignment[] kin) : this( KinFactionGuardCostTypes.MediumCost, permission, kin) { }
public BaseClothing(int itemID, Layer layer, int hue) : base( itemID ) { Layer = layer; Hue = hue; m_Quality = ClothingQuality.Regular; m_MagicType = MagicEffect.None; m_MagicCharges = 0; m_Identified = true; m_IOBAlignment = IOBAlignment.None; //Pigpen - Addition for IOB System m_InvisTimer = null; m_StatEffectTimer = null; m_Dyable = true; //Froste - Addition for dye control m_Scissorable = true; // Adam - Addition for better Scissor control // erl: added for clothing wear m_HitPoints = m_MaxHitPoints = (short) Utility.RandomMinMax( InitMinHits, InitMaxHits ); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 14: { //version 14 m_Coords = ReadRect3DArray(reader); m_InnBounds = ReadRect3DArray(reader); goto case 13; } case 13: { m_TargetMap = reader.ReadMap(); m_GoLocation = reader.ReadPoint3D(); m_MinZ = reader.ReadInt(); m_MaxZ = reader.ReadInt(); goto case 12; } case 12: { m_Enabled = reader.ReadBool(); goto case 11; } case 11: { int size = reader.ReadInt(); m_Types = new ArrayList(size); for (int i = 0; i < size; ++i) { string typeName = reader.ReadString(); m_Types.Add(typeName); } goto case 10; } case 10: { m_MaxFollowers = reader.ReadInt(); goto case 9; } case 9: { m_RestrictedMagicMsg = reader.ReadString(); goto case 8; } case 8: { m_Music = (MusicName)reader.ReadInt(); goto case 7; } case 7: { if (m_InnBounds == null) { m_InnBounds = ReadRect2DArray(reader); } else { m_InnBounds.AddRange(ReadRect2DArray(reader)); } m_InnLogoutDelay = reader.ReadTimeSpan(); goto case 6; } case 6: { m_PlayerLogoutDelay = reader.ReadTimeSpan(); goto case 5; } case 5: { if (version < 13) { // converted to a flag bool m_IsDungeon = (bool)reader.ReadBool(); IsDungeon = m_IsDungeon; } goto case 4; } case 4: { m_IOBAlignment = (IOBAlignment)reader.ReadInt(); goto case 3; } case 3: { m_LightLevel = reader.ReadInt(); goto case 2; } case 2: { goto case 1; } case 1: { if (Coords == null) { Coords = ReadRect2DArray(reader); } else { Coords.AddRange(ReadRect2DArray(reader)); } m_Priority = (CustomRegionPriority)reader.ReadInt(); m_RestrictedSpells = ReadBitArray(reader); m_RestrictedSkills = ReadBitArray(reader); m_Flags = (RegionFlag)reader.ReadInt(); m_RegionName = reader.ReadString(); break; } case 0: { Coords = new ArrayList(); Coords.Add(reader.ReadRect2D()); m_RestrictedSpells = ReadBitArray(reader); m_RestrictedSkills = ReadBitArray(reader); m_Flags = (RegionFlag)reader.ReadInt(); m_RegionName = reader.ReadString(); break; } } if (version < 12) { m_Enabled = true; } if (version < 11) { m_Types = new ArrayList(); } if (version < 8) { m_Music = MusicName.Invalid; } // fixup this table if Skills have been added or removed. if (SkillInfo.Table.Length != m_RestrictedSkills.Count) { BitArray temp = new BitArray(SkillInfo.Table.Length); int MaxIterations = Math.Min(temp.Length, m_RestrictedSkills.Count); for (int ix = 0; ix < MaxIterations; ix++) { temp[ix] = m_RestrictedSkills[ix]; } m_RestrictedSkills = temp; } // fixup this table if Spells have been added or removed. if (SpellRegistry.Types.Length != m_RestrictedSpells.Count) { BitArray temp = new BitArray(SpellRegistry.Types.Length); int MaxIterations = Math.Min(temp.Length, m_RestrictedSpells.Count); for (int ix = 0; ix < MaxIterations; ix++) { temp[ix] = m_RestrictedSpells[ix]; } m_RestrictedSkills = temp; } UpdateRegion(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 14: { //version 14 m_Coords=ReadRect3DArray(reader); m_InnBounds=ReadRect3DArray(reader); goto case 13; } case 13: { m_TargetMap = reader.ReadMap(); m_GoLocation = reader.ReadPoint3D(); m_MinZ = reader.ReadInt(); m_MaxZ = reader.ReadInt(); goto case 12; } case 12: { m_Enabled = reader.ReadBool(); goto case 11; } case 11: { int size = reader.ReadInt(); m_Types = new ArrayList(size); for (int i = 0; i < size; ++i) { string typeName = reader.ReadString(); m_Types.Add(typeName); } goto case 10; } case 10: { m_MaxFollowers = reader.ReadInt(); goto case 9; } case 9: { m_RestrictedMagicMsg = reader.ReadString(); goto case 8; } case 8: { m_Music = (MusicName)reader.ReadInt(); goto case 7; } case 7: { if (m_InnBounds == null) { m_InnBounds = ReadRect2DArray(reader); } else { m_InnBounds.AddRange(ReadRect2DArray(reader)); } m_InnLogoutDelay = reader.ReadTimeSpan(); goto case 6; } case 6: { m_PlayerLogoutDelay = reader.ReadTimeSpan(); goto case 5; } case 5: { if (version < 13) { // converted to a flag bool m_IsDungeon = (bool)reader.ReadBool(); IsDungeon = m_IsDungeon; } goto case 4; } case 4: { m_IOBAlignment = (IOBAlignment)reader.ReadInt(); goto case 3; } case 3: { m_LightLevel = reader.ReadInt(); goto case 2; } case 2: { goto case 1; } case 1: { if (Coords == null) { Coords = ReadRect2DArray(reader); } else { Coords.AddRange(ReadRect2DArray(reader)); } m_Priority = (CustomRegionPriority)reader.ReadInt(); m_RestrictedSpells = ReadBitArray(reader); m_RestrictedSkills = ReadBitArray(reader); m_Flags = (RegionFlag)reader.ReadInt(); m_RegionName = reader.ReadString(); break; } case 0: { Coords = new ArrayList(); Coords.Add(reader.ReadRect2D()); m_RestrictedSpells = ReadBitArray(reader); m_RestrictedSkills = ReadBitArray(reader); m_Flags = (RegionFlag)reader.ReadInt(); m_RegionName = reader.ReadString(); break; } } if (version < 12) { m_Enabled = true; } if (version < 11) { m_Types = new ArrayList(); } if (version < 8) { m_Music = MusicName.Invalid; } // fixup this table if Skills have been added or removed. if (SkillInfo.Table.Length != m_RestrictedSkills.Count) { BitArray temp = new BitArray(SkillInfo.Table.Length); int MaxIterations = Math.Min(temp.Length, m_RestrictedSkills.Count); for (int ix = 0; ix < MaxIterations; ix++) temp[ix] = m_RestrictedSkills[ix]; m_RestrictedSkills = temp; } // fixup this table if Spells have been added or removed. if (SpellRegistry.Types.Length != m_RestrictedSpells.Count) { BitArray temp = new BitArray(SpellRegistry.Types.Length); int MaxIterations = Math.Min(temp.Length, m_RestrictedSpells.Count); for (int ix = 0; ix < MaxIterations; ix++) temp[ix] = m_RestrictedSpells[ix]; m_RestrictedSkills = temp; } UpdateRegion(); }
private void DupeCustomBits(Region r) { //pla: replicate custom region if (r is CustomRegion) { RegionControl rc = (r as CustomRegion).GetRegionControler(); if (rc != null) { //copy all the flags and restricted stuff this.m_Flags = rc.m_Flags; this.m_RestrictedSpells = new BitArray(rc.m_RestrictedSpells); this.m_RestrictedSkills = new BitArray(rc.m_RestrictedSkills); this.m_RestrictedMagicMsg = rc.m_RestrictedMagicMsg; this.m_InnLogoutDelay = rc.InnLogoutDelay; this.m_IOBAlignment = rc.IOBAlign; this.m_MaxFollowers = rc.MaxFollowerSlots; this.m_Music = r.Music; this.SetFlag(RegionFlag.Music, (r.Music != MusicName.Invalid)); if (rc.LightLevel > 0) this.m_LightLevel = rc.LightLevel; this.m_Types.Clear(); if (rc.m_Types != null && rc.m_Types.Count > 0) { ArrayList t = rc.m_Types; for (int i = 0; i < rc.m_Types.Count; ++i) if (t[i] is string) this.m_Types.Add((string)t[i]); } } else { this.SendMessage(String.Format("Region controller for custom region '" + r.Name + "' could not be found.\n\rCustom properties and flags have not been cloned successfully")); } } }
public static bool CalcAwardInSilver(Mobile m, out int silver, out int gold) { // new award amounts silver = gold = 0; if (m == null || m is BaseCreature == false) { return(false); } BaseCreature bc = m as BaseCreature; // creature must be IOB aligned if (IOBSystem.IsIOBAligned(bc) == false) { return(false); } //creature must not be controlled if (bc.ControlMaster != null) { return(false); } // first find out how much gold this creature is dropping as that will be the gauge for the silver drop int MobGold = bc.GetGold(); // meh, random I know gold = MobGold / 2; // cut the gold in half silver = MobGold / 10; // and give him 10% in silver // now calc the damagers. bool fail = false; ArrayList list = BaseCreature.GetLootingRights(bc.DamageEntries); IOBAlignment IOBBase = IOBAlignment.None; for (int i = 0; i < list.Count; ++i) { DamageStore ds = (DamageStore)list[i]; if (!ds.m_HasRight) { continue; } if (ds.m_Mobile != null) { // initialize the required IOBAlignment (one time) if (IOBBase == IOBAlignment.None) { IOBBase = IOBSystem.GetIOBAlignment(ds.m_Mobile); } // ds.m_Mobile may be a basecreature or a playermobile // 1. if the damager is not an ememy of the creature it killed, then no silver awards // 2. if all damagers are not of the same alignment, then no silver awards // 3. if the top damager was an interferer, no silver awards if (IOBSystem.IsEnemy(ds.m_Mobile, m) == false || IOBBase != IOBSystem.GetIOBAlignment(ds.m_Mobile) || IOBBase == IOBAlignment.Healer) { // no silver awards fail = true; break; } } } // see if there were any non same-kin damagers. // we won't reward silver if there was outside help if (fail == true) { return(false); } // okay, we have new amounts return(true); }
public static int MobileNotoriety(Mobile source, Mobile target) { // adam: sanity if (source == null || target == null) { if (source == null) { Console.WriteLine("(source == null) in Notoriety::MobileNotoriety"); } if (target == null) { Console.WriteLine("(target == null) in Notoriety::MobileNotoriety"); } //return; } if (Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)) { return(Notoriety.Invulnerable); } if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } /* * //Begin Challenge Duel Additions * if (target is PlayerMobile && source is PlayerMobile) * { * bool tc = ((PlayerMobile)target).IsInChallenge; * bool sc = (((PlayerMobile)source).IsInChallenge); * if (tc && sc) //both in challenge * { * foreach (Item c in Challenge.Challenge.WorldStones) * { * ChallengeStone cs = c as ChallengeStone; * if (cs.OpponentTeam.Contains(target) || cs.ChallengeTeam.Contains(target)) * { * if (cs.OpponentTeam.Contains(source) || cs.ChallengeTeam.Contains(source)) * { * return Notoriety.CanBeAttacked; * } * } * } * } * } * //End Challenge Duel Additions */ if (source.Player && !target.Player && source is PlayerMobile && target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (!bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } if (target.Kills >= 5 || (target.Body.IsMonster && IsSummoned(target as BaseCreature) && !(target is BaseFamiliar) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead))) { return(Notoriety.Murderer); } if (target.Criminal) { return(Notoriety.Criminal); } Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); Guild targetGuild = GetGuildFor(target.Guild as Guild, target); if ((sourceGuild != null && targetGuild != null) && (sourceGuild.Peaceful == false && targetGuild.Peaceful == false)) { if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) { return(Notoriety.Ally); } else if (sourceGuild.IsEnemy(targetGuild)) { return(Notoriety.Enemy); } } //If both are registered with the fightbroker, they can both attack each other if (FightBroker.IsAlreadyRegistered(source) && FightBroker.IsAlreadyRegistered(target) && (source != target)) { return(Notoriety.Enemy); } //If the source is registered on the fightbroker and the target is an interferer, make the target fair game if (FightBroker.IsAlreadyRegistered(source) && FightBroker.IsHealerInterferer(target) && (source != target)) { return(Notoriety.CanBeAttacked); } //Now handle pets of the people registered with the fightbroker if (source is BaseCreature && target is BaseCreature) { BaseCreature src = (BaseCreature)source; BaseCreature tgt = (BaseCreature)target; if (src.ControlMaster != null && tgt.ControlMaster != null) { if (FightBroker.IsAlreadyRegistered(src.ControlMaster) && FightBroker.IsAlreadyRegistered(tgt.ControlMaster) && (src.ControlMaster != tgt.ControlMaster)) { return(Notoriety.Enemy); } } } else if (source is PlayerMobile && target is BaseCreature) { BaseCreature tgt = (BaseCreature)target; if (tgt.ControlMaster != null) { if (FightBroker.IsAlreadyRegistered(source) && FightBroker.IsAlreadyRegistered(tgt.ControlMaster) && (source != tgt.ControlMaster)) { return(Notoriety.Enemy); } } } else if (source is BaseCreature && target is PlayerMobile) { BaseCreature src = (BaseCreature)source; if (src.ControlMaster != null) { if (FightBroker.IsAlreadyRegistered(target) && FightBroker.IsAlreadyRegistered(src.ControlMaster) && (target != src.ControlMaster)) { return(Notoriety.Enemy); } } } //done with pets/fightbroker status //Now handle IOB status hueing if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.IOBShardWide) || (Server.Engines.IOBSystem.IOBRegions.IsInIOBRegion(source) && Server.Engines.IOBSystem.IOBRegions.IsInIOBRegion(target))) { IOBAlignment srcIOBAlignment = IOBAlignment.None; IOBAlignment trgIOBAlignment = IOBAlignment.None; if (source is BaseCreature) { srcIOBAlignment = ((BaseCreature)source).IOBAlignment; } else if (source is PlayerMobile) { srcIOBAlignment = ((PlayerMobile)source).IOBAlignment; } if (target is BaseCreature) { trgIOBAlignment = ((BaseCreature)target).IOBAlignment; } else if (target is PlayerMobile) { trgIOBAlignment = ((PlayerMobile)target).IOBAlignment; } if (srcIOBAlignment != IOBAlignment.None && trgIOBAlignment != IOBAlignment.None && srcIOBAlignment != IOBAlignment.Healer ) { //If they're different alignments OR target is OutCast, then they're an enemy //Pix 12/3/07: added healer target //Pix: 12/4/07 - now kin-healers flag canbeattacked to kin instead of enemy if (trgIOBAlignment == IOBAlignment.Healer) { return(Notoriety.CanBeAttacked); } else if (srcIOBAlignment != trgIOBAlignment || trgIOBAlignment == IOBAlignment.OutCast) { return(Notoriety.Enemy); } else { if (source is PlayerMobile && target is BaseCreature) { return(Notoriety.Ally); } else { //Pix: 4/28/06 - removed Ally notoriety of same-aligned kin - // this is now handled by guilds via allying //return Notoriety.Ally; } } } //if we're looking at ourselves, and we're a KinHealer, show ourself as enemy if (source == target && srcIOBAlignment == IOBAlignment.Healer) { return(Notoriety.Enemy); } } //done with IOB status hueing if (SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature && ((BaseCreature)target).AlwaysAttackable) { return(Notoriety.CanBeAttacked); } if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent && ((BaseCreature)target).Controlled == false)) { if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature)) { return(Notoriety.CanBeAttacked); } } if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target)) { return(Notoriety.CanBeAttacked); } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source) { return(Notoriety.CanBeAttacked); } if (source is BaseCreature) // here we're dealing with 2 BC { BaseCreature sbc = (BaseCreature)source; if (sbc.Controlled && bc.Controlled && sbc.ControlMaster == bc.ControlMaster) { //return Notoriety.CanBeAttacked; return(Notoriety.Ally); } } } if (target is BaseCreature) { BaseCreature bc = (BaseCreature)target; if (bc.IOBFollower) { return(Notoriety.CanBeAttacked); } } /* * Adam didn't want this way. * //Last check -- see if the target's region is a NoCount zone... * // if so, notoriety should be CanBeAttacked * CustomRegion targetRegion = target.Region as CustomRegion; * if( targetRegion != null ) * { * RegionControl rc = targetRegion.GetRegionControler(); * if( rc != null && rc.NoMurderZone ) * { * return Notoriety.CanBeAttacked; * } * } */ return(Notoriety.Innocent); }
private string TranslateIOBName(IOBAlignment iob) { return(Engines.IOBSystem.IOBSystem.GetIOBName(iob)); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 8: //erl - added to handle packing out of PlayerConstructed property { goto case 7; } case 7: //erl - added for clothing wear { m_HitPoints = reader.ReadShort(); m_MaxHitPoints = reader.ReadShort(); goto case 6; } case 6: //Adam - Addition for Scissorable attribute { m_Scissorable = reader.ReadBool(); goto case 5; } case 5: //Adam - Addition for Dyable attribute { m_Dyable = reader.ReadBool(); goto case 4; } case 4: //Pigpen - Addition for IOB System { m_IOBAlignment = (IOBAlignment)reader.ReadInt(); goto case 3; } case 3: { m_MagicType = (MagicEffect)reader.ReadInt(); m_MagicCharges = reader.ReadInt(); m_Identified = reader.ReadBool(); goto case 2; } case 2: { // erl: this is the old PlayerConstructed flag, which will no longer // exist for anything over version 7... made obsolete by PlayerCrafted if (version < 8) { PlayerCrafted = reader.ReadBool(); } goto case 1; } case 1: { m_Crafter = reader.ReadMobile(); m_Quality = (ClothingQuality)reader.ReadInt(); break; } case 0: { m_Crafter = null; m_Quality = ClothingQuality.Regular; break; } } if (version < 5) // Adam - addition for dye control { // Allow for other non-dyable clothes outside the IOB system if (m_IOBAlignment != IOBAlignment.None) { m_Dyable = false; } } if (version < 7) { // erl: this pre-dates hit point additions, so calculate values // .. // Check the quality of the piece. If it's exceptional or low, we want // the piece's hitpoint to reflect this int iMax = InitMaxHits; int iMin = InitMinHits; if (Quality == ClothingQuality.Exceptional) { // Add 50% to both iMax = (iMax * 3) / 2; // Fixed order of precedence bug iMin = (iMin * 3) / 2; } else if (Quality == ClothingQuality.Low) { // Lose 20% to both iMax = (iMax * 4) / 5; // Fixed order of precedence bug iMin = (iMin * 4) / 5; } m_HitPoints = m_MaxHitPoints = (short)Utility.RandomMinMax(iMin, iMax); } // adam: To keep players from farming new characters for newbie clothes // we are moving this valuable resource into the hands of crafters. if (version <= 7) { if (Quality == ClothingQuality.Exceptional && MagicCharges == 0) { // make exceptional clothes newbied LootType = LootType.Newbied; } else if (MagicCharges > 0) { // erl: explicitly change these pieces so they aren't newbied LootType = LootType.Regular; } } }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 1: { goto case 0; } case 0: { m_Lifted = reader.ReadItemList(); m_IOBAlignment = (IOBAlignment)reader.ReadInt(); break; } } }
/// <summary> /// Transfers owership of a city to a kin or golem controller king /// </summary> /// <param name="city"></param> /// <param name="winners"></param> public static void TransferOwnership(KinFactionCities city, IOBAlignment kin, List <PlayerMobile> winners) { KinCityData cd = GetCityData(city); if (cd == null) { Console.WriteLine("Error in KinCityManager.TransferOwnership() - City Data not found"); return; } //Set props that apply to both GC and Kin cd.CityLeader = null; cd.CaptureTime = DateTime.Now; cd.ClearAllGuardPosts(); cd.ClearActivityDelta(); if (kin == IOBAlignment.None) //GCs! { cd.ControlingKin = kin; //setup defaults for a controller city cd.IsVotingStage = false; cd.TaxRate = 0.0; cd.BeneficiaryDataList.Clear(); cd.UnassignedGuardPostSlots = 0; //Absorb treasury cd.EmptyTreasury(); ChangeGuards(city, KinCityData.GuardOptions.None, true); cd.ClearNPCFLags(); //Update townspeople spawners and switch on GCs UpdateCityNPCSpawners(cd.City); if (OnGolemController != null) { OnGolemController(cd.City, true); } } else { //check to see if the city was previously owned by the controllers if (cd.ControlingKin == IOBAlignment.None) { //if so then apply default settings for a town cd.SetAllNPCFlags(); ChangeGuards(city, KinCityData.GuardOptions.None, true); //Set last change time so they can change the guards immediately cd.LastGuardChangeTime = DateTime.Now.AddHours(-KinSystemSettings.GuardChangeTimeHours); //Update townspeople spawners and switch off GCs UpdateCityNPCSpawners(cd.City); SetGolemControllers(cd.City, false); if (OnGolemController != null) { OnGolemController(cd.City, false); } } else { cd.LastGuardChangeTime = DateTime.Now.AddHours(-KinSystemSettings.GuardChangeTimeHours); } cd.ControlingKin = kin; //Assign voting info cd.BeneficiaryDataList.Clear(); foreach (PlayerMobile pm in winners) { cd.BeneficiaryDataList.Add(new KinCityData.BeneficiaryData(pm, 0)); } //Change the guards to none if it is LB incase the new owners are all red if (cd.GuardOption == KinCityData.GuardOptions.LordBritish) { ChangeGuards(cd.City, KinCityData.GuardOptions.None, true); } //Skip voting if only one beneficiary if (cd.BeneficiaryDataList.Count == 1) { cd.CityLeader = cd.BeneficiaryDataList[0].Pm; } else { cd.IsVotingStage = true; } cd.UnassignedGuardPostSlots = KinSystem.GetCityGuardPostSlots(city); //Voting is controlled by heartbeat } }