public static Guild GetGuildFor( BaseGuild def, Mobile m ) { Guild g = def as Guild; BaseCreature c = m as BaseCreature; if ( c != null ) { if ( c.Controled && c.ControlMaster != null ) { c.DisplayGuildTitle = false; if ( c.Map != Map.Internal ) c.Guild = g = c.ControlMaster.Guild as Guild; else c.Guild = g = null; } else if ( c.Summoned && c.SummonMaster != null ) { c.DisplayGuildTitle = false; if ( c.Map != Map.Internal ) c.Guild = g = c.SummonMaster.Guild as Guild; else c.Guild = g = null; } } return g; }
public override void Write( BaseGuild value ) { if ( value == null ) Write( 0 ); else Write( value.Id ); }
public abstract void Write( BaseGuild value );
public void Clear() { m_Guild = null; }
public GuildEntry( BaseGuild g, long pos, int length ) { m_Guild = g; m_Position = pos; m_Length = length; }
public override void OnGuildChange(BaseGuild oldGuild) { InvalidateMyRunUO(); }
public static BaseGuild EventSink_CreateGuild(CreateGuildEventArgs args) { BaseGuild g = (BaseGuild)(new Guild(args.Id)); return(g); }
public override void OnResponse(NetState sender, RelayInfo info) { if (!(sender.Mobile is PlayerMobile pm) || pm.Guild != null) { return; // Sanity } switch (info.ButtonID) { case 1: { var tName = info.GetTextEntry(5); var tAbbrev = info.GetTextEntry(6); var guildName = tName == null ? "" : tName.Text; var guildAbbrev = tAbbrev == null ? "" : tAbbrev.Text; guildName = Utility.FixHtml(guildName.Trim()); guildAbbrev = Utility.FixHtml(guildAbbrev.Trim()); if (guildName.Length <= 0) { pm.SendLocalizedMessage(1070884); // Guild name cannot be blank. } else if (guildAbbrev.Length <= 0) { pm.SendLocalizedMessage(1070885); // You must provide a guild abbreviation. } else if (guildName.Length > Guild.NameLimit) { pm.SendLocalizedMessage( 1063036, Guild.NameLimit.ToString() ); // A guild name cannot be more than ~1_val~ characters in length. } else if (guildAbbrev.Length > Guild.AbbrevLimit) { pm.SendLocalizedMessage( 1063037, Guild.AbbrevLimit.ToString() ); // An abbreviation cannot exceed ~1_val~ characters in length. } else if (BaseGuild.FindByAbbrev(guildAbbrev) != null || !BaseGuildGump.CheckProfanity(guildAbbrev)) { pm.SendLocalizedMessage(501153); // That abbreviation is not available. } else if (BaseGuild.FindByName(guildName) != null || !BaseGuildGump.CheckProfanity(guildName)) { pm.SendLocalizedMessage(1063000); // That guild name is not available. } else if (!Banker.Withdraw(pm, Guild.RegistrationFee)) { pm.SendLocalizedMessage( 1063001, Guild.RegistrationFee .ToString() ); // You do not possess the ~1_val~ gold piece fee required to create a guild. } else { pm.SendLocalizedMessage( 1060398, Guild.RegistrationFee.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. pm.SendLocalizedMessage(1063238); // Your new guild has been founded. pm.Guild = new Guild(pm, guildName, guildAbbrev); } break; } case 2: { pm.AcceptGuildInvites = !pm.AcceptGuildInvites; if (pm.AcceptGuildInvites) { pm.SendLocalizedMessage(1070699); // You are now accepting guild invitations. } else { pm.SendLocalizedMessage(1070698); // You are now ignoring guild invitations. } break; } } }
public virtual void OnGuildChange( BaseGuild oldGuild ) { }
public virtual void Deserialize( GenericReader reader ) { int version = reader.ReadInt(); switch ( version ) { case 28: { m_LastStatGain = reader.ReadDeltaTime(); goto case 27; } case 27: { m_TithingPoints = reader.ReadInt(); goto case 26; } case 26: case 25: case 24: { m_Corpse = reader.ReadItem() as Container; goto case 23; } case 23: { m_CreationTime = reader.ReadDateTime(); goto case 22; } case 22: // Just removed followers case 21: { m_Stabled = reader.ReadMobileListOrNull(); goto case 20; } case 20: { m_CantWalk = reader.ReadBool(); goto case 19; } case 19: // Just removed variables case 18: { m_Virtues = VirtueInfo.Deserialize( reader ); goto case 17; } case 17: { m_Thirst = reader.ReadInt(); m_BAC = reader.ReadInt(); goto case 16; } case 16: { m_ShortTermMurders = reader.ReadInt(); if ( version <= 24 ) { reader.ReadDateTime(); reader.ReadDateTime(); } goto case 15; } case 15: { if ( version < 22 ) reader.ReadInt(); // followers m_FollowersMax = reader.ReadInt(); goto case 14; } case 14: { m_MagicDamageAbsorb = reader.ReadInt(); goto case 13; } case 13: { m_GuildFealty = reader.ReadMobile(); goto case 12; } case 12: { m_Guild = reader.ReadGuild(); goto case 11; } case 11: { m_DisplayGuildTitle = reader.ReadBool(); goto case 10; } case 10: { m_CanSwim = reader.ReadBool(); goto case 9; } case 9: { m_Squelched = reader.ReadBool(); goto case 8; } case 8: { m_Holding = reader.ReadItem(); goto case 7; } case 7: { m_VirtualArmor = reader.ReadInt(); goto case 6; } case 6: { m_BaseSoundID = reader.ReadInt(); goto case 5; } case 5: { m_DisarmReady = reader.ReadBool(); m_StunReady = reader.ReadBool(); goto case 4; } case 4: { if ( version <= 25 ) { Poison.Deserialize( reader ); /*if ( m_Poison != null ) { m_PoisonTimer = new PoisonTimer( this ); m_PoisonTimer.Start(); }*/ } goto case 3; } case 3: { m_StatCap = reader.ReadInt(); goto case 2; } case 2: { m_NameHue = reader.ReadInt(); goto case 1; } case 1: { m_Hunger = reader.ReadInt(); goto case 0; } case 0: { if ( version < 11 ) m_DisplayGuildTitle = true; if ( version < 3 ) m_StatCap = 225; if ( version < 15 ) { m_Followers = 0; m_FollowersMax = 5; } m_Location = reader.ReadPoint3D(); m_Body = new Body( reader.ReadInt() ); m_Name = reader.ReadString(); if (m_Name != null) m_Name = string.Intern(m_Name); m_GuildTitle = reader.ReadString(); m_Criminal = reader.ReadBool(); m_Kills = reader.ReadInt(); m_SpeechHue = reader.ReadInt(); m_EmoteHue = reader.ReadInt(); m_WhisperHue = reader.ReadInt(); m_YellHue = reader.ReadInt(); m_Language = reader.ReadString(); if (m_Language != null) m_Language = string.Intern(m_Language); m_Female = reader.ReadBool(); m_Warmode = reader.ReadBool(); m_Hidden = reader.ReadBool(); m_Direction = (Direction) reader.ReadByte(); m_Hue = reader.ReadInt(); m_Str = reader.ReadInt(); m_Dex = reader.ReadInt(); m_Int = reader.ReadInt(); m_Hits = reader.ReadInt(); m_Stam = reader.ReadInt(); m_Mana = reader.ReadInt(); m_Map = reader.ReadMap(); m_Blessed = reader.ReadBool(); m_Fame = reader.ReadInt(); m_Karma = reader.ReadInt(); m_AccessLevel = (AccessLevel) reader.ReadByte(); m_Skills = new Skills( this, reader ); int itemCount = reader.ReadInt(); m_Items = new ArrayList( itemCount ); for ( int i = 0; i < itemCount; ++i ) { Item item = reader.ReadItem(); if ( item != null ) m_Items.Add( item ); } m_Player = reader.ReadBool(); m_Title = reader.ReadString(); if (m_Title != null) m_Title = string.Intern(m_Title); m_Profile = reader.ReadString(); m_ProfileLocked = reader.ReadBool(); if ( version <= 18 ) { /*m_LightLevel =*/ reader.ReadInt(); /*m_TotalGold =*/ reader.ReadInt(); /*m_TotalWeight =*/ reader.ReadInt(); } m_AutoPageNotify = reader.ReadBool(); m_LogoutLocation = reader.ReadPoint3D(); m_LogoutMap = reader.ReadMap(); m_StrLock = (StatLockType)reader.ReadByte(); m_DexLock = (StatLockType)reader.ReadByte(); m_IntLock = (StatLockType)reader.ReadByte(); if ( reader.ReadBool() ) { m_StuckMenuUses = new DateTime[reader.ReadInt()]; for ( int i = 0; i < m_StuckMenuUses.Length; ++i ) { m_StuckMenuUses[i] = reader.ReadDateTime(); } } else { m_StuckMenuUses = null; } if ( m_Player && m_Map != Map.Internal ) { m_LogoutLocation = m_Location; m_LogoutMap = m_Map; m_Map = Map.Internal; } if ( m_Map != null ) m_Map.OnEnter( this ); if ( m_Criminal ) { if ( m_ExpireCriminal == null ) m_ExpireCriminal = new ExpireCriminalTimer( this ); m_ExpireCriminal.Start(); } if ( ShouldCheckStatTimers ) CheckStatTimers(); if ( !m_Player && m_Dex <= 100 && m_CombatTimer != null ) m_CombatTimer.Priority = TimerPriority.FiftyMS; else if ( m_CombatTimer != null ) m_CombatTimer.Priority = TimerPriority.EveryTick; m_Region = Region.Find( m_Location, m_Map ); m_Region.InternalEnter( this ); UpdateResistances(); break; } } }
public override void OnGuildChange(BaseGuild oldGuild) { EventSink.InvokeMobileInvalidate( new MobileInvalidateEventArgs( this) ); }
public virtual void Deserialize( GenericReader reader ) { int version = reader.ReadInt(); switch ( version ) { case 36: case 35: case 34: { byte hairflag = reader.ReadByte(); if ( ( hairflag & 0x01 ) != 0 ) m_Hair = new HairInfo( reader ); if ( ( hairflag & 0x02 ) != 0 ) m_FacialHair = new FacialHairInfo( reader ); m_InstanceID = reader.ReadInt(); m_Race = reader.ReadRace(); if ( version < 36 ) reader.ReadDeltaTime(); m_TithingPoints = reader.ReadInt(); m_Corpse = reader.ReadItem() as Container; m_CreationTime = reader.ReadDateTime(); m_Stabled = reader.ReadStrongMobileList(); m_CantWalk = reader.ReadBool(); m_Virtues = new VirtueInfo( reader ); m_Thirst = reader.ReadInt(); m_BAC = reader.ReadInt(); m_ShortTermMurders = reader.ReadInt(); if ( version < 35 ) reader.ReadInt(); m_MagicDamageAbsorb = reader.ReadInt(); m_GuildFealty = reader.ReadMobile(); m_Guild = reader.ReadGuild(); m_DisplayGuildTitle = reader.ReadBool(); m_CanSwim = reader.ReadBool(); m_Squelched = reader.ReadBool(); m_Holding = reader.ReadItem(); m_BaseSoundID = reader.ReadInt(); m_DisarmReady = reader.ReadBool(); m_StunReady = reader.ReadBool(); m_StatCap = reader.ReadInt(); m_NameHue = reader.ReadInt(); m_Hunger = reader.ReadInt(); m_Location = reader.ReadPoint3D(); m_Body = new Body( reader.ReadInt() ); m_Name = reader.ReadString(); if ( m_Name != null ) m_Name = string.Intern( m_Name ); m_GuildTitle = reader.ReadString(); m_Criminal = reader.ReadBool(); m_Kills = reader.ReadInt(); m_SpeechHue = reader.ReadInt(); m_EmoteHue = reader.ReadInt(); m_WhisperHue = reader.ReadInt(); m_YellHue = reader.ReadInt(); m_Language = reader.ReadString(); if ( m_Language != null ) m_Language = string.Intern( m_Language ); m_Female = reader.ReadBool(); m_Warmode = reader.ReadBool(); m_Hidden = reader.ReadBool(); m_Direction = (Direction) reader.ReadByte(); m_Hue = reader.ReadInt(); m_Str = reader.ReadInt(); m_Dex = reader.ReadInt(); m_Int = reader.ReadInt(); m_Hits = reader.ReadInt(); m_Stam = reader.ReadInt(); m_Mana = reader.ReadInt(); m_Map = reader.ReadMap(); m_Blessed = reader.ReadBool(); m_Fame = reader.ReadInt(); m_Karma = reader.ReadInt(); m_AccessLevel = (AccessLevel) reader.ReadByte(); m_Skills = new Skills( this, reader ); int itemCount = reader.ReadInt(); m_EquippedItems = new List<Item>( itemCount ); for ( int i = 0; i < itemCount; ++i ) { Item item = reader.ReadItem(); if ( item != null ) m_EquippedItems.Add( item ); } m_IsPlayer = reader.ReadBool(); m_Title = reader.ReadString(); if ( m_Title != null ) m_Title = string.Intern( m_Title ); m_Profile = reader.ReadString(); m_ProfileLocked = reader.ReadBool(); m_AutoPageNotify = reader.ReadBool(); m_LogoutLocation = reader.ReadPoint3D(); m_LogoutMap = reader.ReadMap(); m_StrLock = (StatLockType) reader.ReadByte(); m_DexLock = (StatLockType) reader.ReadByte(); m_IntLock = (StatLockType) reader.ReadByte(); m_StatMods = new List<StatMod>(); if ( reader.ReadBool() ) { m_StuckMenuUses = new DateTime[reader.ReadInt()]; for ( int i = 0; i < m_StuckMenuUses.Length; ++i ) { m_StuckMenuUses[i] = reader.ReadDateTime(); } } else { m_StuckMenuUses = null; } if ( m_IsPlayer && m_Map != Map.Internal ) { m_LogoutLocation = m_Location; m_LogoutMap = m_Map; m_Map = Map.Internal; } if ( m_Map != null ) m_Map.OnEnter( this ); if ( m_Criminal ) { if ( m_ExpireCriminal == null ) m_ExpireCriminal = new ExpireCriminalTimer( this ); m_ExpireCriminal.Start(); } if ( ShouldCheckStatTimers ) CheckStatTimers(); UpdateRegion(); UpdateResistances(); break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { var pm = sender.Mobile as PlayerMobile; if (pm == null || pm.Guild != null) { return; //Sanity } switch (info.ButtonID) { case 1: { TextRelay tName = info.GetTextEntry(5); TextRelay tAbbrev = info.GetTextEntry(6); string guildName = (tName == null) ? "" : tName.Text; string guildAbbrev = (tAbbrev == null) ? "" : tAbbrev.Text; guildName = Utility.FixHtml(guildName.Trim()); guildAbbrev = Utility.FixHtml(guildAbbrev.Trim()); Type cType = pm.Expansion == Expansion.T2A ? typeof(Silver) : typeof(Gold); if (guildName.Length <= 0) { pm.SendLocalizedMessage(1070884); // Guild name cannot be blank. } else if (guildAbbrev.Length <= 0) { pm.SendLocalizedMessage(1070885); // You must provide a guild abbreviation. } else if (guildName.Length > Guild.NameLimit) { pm.SendLocalizedMessage(1063036, Guild.NameLimit.ToString("#,0")); // A guild name cannot be more than ~1_val~ characters in length. } else if (guildAbbrev.Length > Guild.AbbrevLimit) { pm.SendLocalizedMessage(1063037, Guild.AbbrevLimit.ToString("#,0")); // An abbreviation cannot exceed ~1_val~ characters in length. } else if (BaseGuild.FindByAbbrev(guildAbbrev) != null || !BaseGuildGump.CheckProfanity(guildAbbrev)) { pm.SendLocalizedMessage(501153); // That abbreviation is not available. } else if (BaseGuild.FindByName(guildName) != null || !BaseGuildGump.CheckProfanity(guildName)) { pm.SendLocalizedMessage(1063000); // That guild name is not available. } else if (!Banker.Withdraw(pm, cType, Guild.RegistrationFee)) { pm.SendMessage( "You do not possess the {0:#,0} {1} fee required to create a guild.", Guild.RegistrationFee, cType.Name); } else { pm.SendMessage("{0:#,0} {1} has been withdrawn from your bank box.", Guild.RegistrationFee, cType.Name); pm.SendLocalizedMessage(1063238); // Your new guild has been founded. pm.Guild = new Guild(pm, guildName, guildAbbrev); } } break; case 2: { pm.AcceptGuildInvites = !pm.AcceptGuildInvites; // You are now accepting guild invitations. : You are now ignoring guild invitations. pm.SendLocalizedMessage(pm.AcceptGuildInvites ? 1070699 : 1070698); } break; } }
public virtual void Deserialize(GenericReader reader) { int version = reader.ReadInt(); switch (version) { case 31: { m_STRBonusCap = reader.ReadInt(); goto case 30; } case 30: { int size = reader.ReadInt32(); FlyIDs = new int[size]; for (int i = 0; i < size; i++) { FlyIDs[i] = reader.ReadInt(); } goto case 29; } case 29: { m_CanFly = reader.ReadBool(); goto case 28; } case 28: { m_LastStatGain = reader.ReadDeltaTime(); goto case 27; } case 27: { m_Flags = (MobileFlags)reader.ReadInt32(); goto case 26; } case 26: case 25: case 24: { m_Corpse = reader.ReadItem() as Container; goto case 23; } case 23: { m_CreationTime = reader.ReadDateTime(); goto case 22; } case 22: // Just removed followers case 21: { m_Stabled = reader.ReadMobileList(); goto case 20; } case 20: { m_CantWalk = reader.ReadBool(); goto case 19; } case 19: // Just removed variables case 18: { m_Virtues = new VirtueInfo(reader); goto case 17; } case 17: { m_Thirst = reader.ReadInt32(); m_BAC = reader.ReadInt32(); goto case 16; } case 16: { m_ShortTermMurders = reader.ReadInt32(); if (version <= 24) { reader.ReadDateTime(); reader.ReadDateTime(); } goto case 15; } case 15: { if (version < 22) reader.ReadInt(); // followers m_FollowersMax = reader.ReadInt32(); goto case 14; } case 14: { m_MagicDamageAbsorb = reader.ReadInt32(); goto case 13; } case 13: { m_GuildFealty = reader.ReadMobile(); goto case 12; } case 12: { m_Guild = reader.ReadGuild(); goto case 11; } case 11: { m_DisplayGuildTitle = reader.ReadBool(); goto case 10; } case 10: { m_CanSwim = reader.ReadBool(); goto case 9; } case 9: { m_Squelched = reader.ReadBool(); goto case 8; } case 8: { m_Holding = reader.ReadItem(); goto case 7; } case 7: { m_VirtualArmor = reader.ReadInt32(); goto case 6; } case 6: { m_BaseSoundID = reader.ReadInt32(); goto case 5; } case 5: { m_DisarmReady = reader.ReadBool(); m_StunReady = reader.ReadBool(); goto case 4; } case 4: { if (version <= 25) { Poison.Deserialize(reader); /*if ( m_Poison != null ) { m_PoisonTimer = new PoisonTimer( this ); m_PoisonTimer.Start(); }*/ } goto case 3; } case 3: { m_StatCap = reader.ReadInt32(); goto case 2; } case 2: { m_NameHue = reader.ReadInt32(); goto case 1; } case 1: { m_Hunger = reader.ReadInt32(); goto case 0; } case 0: { if (version < 21) m_Stabled = new ArrayList(); if (version < 18) m_Virtues = new VirtueInfo(); if (version < 11) m_DisplayGuildTitle = true; if (version < 3) m_StatCap = 225; if (version < 15) { m_Followers = 0; m_FollowersMax = 5; } m_Location = reader.ReadPoint3D(); m_Body = new Body(reader.ReadInt32()); m_Name = reader.ReadString(); m_GuildTitle = reader.ReadString(); m_Criminal = reader.ReadBool(); m_Kills = reader.ReadInt32(); m_SpeechHue = reader.ReadInt32(); m_EmoteHue = reader.ReadInt32(); m_WhisperHue = reader.ReadInt32(); m_YellHue = reader.ReadInt32(); m_Language = reader.ReadString(); m_Female = reader.ReadBool(); m_Warmode = reader.ReadBool(); m_Hidden = reader.ReadBool(); m_Direction = (Direction)reader.ReadByte(); m_Hue = reader.ReadInt32(); m_Str = reader.ReadInt32(); m_Dex = reader.ReadInt32(); m_Int = reader.ReadInt32(); m_Hits = reader.ReadInt32(); m_Stam = reader.ReadInt32(); m_Mana = reader.ReadInt32(); m_Map = reader.ReadMap(); m_Blessed = reader.ReadBool(); m_Fame = reader.ReadInt32(); m_Karma = reader.ReadInt32(); m_AccessLevel = (AccessLevel)reader.ReadByte(); // Convert old bonus caps to 'no cap' if (version < 31) m_STRBonusCap = 0; // Convert old access levels to new access levels if (version < 31) { switch (m_AccessLevel) { case (AccessLevel)0: //OldPlayer = 0, { m_AccessLevel = AccessLevel.Player; break; } case (AccessLevel)1: //OldCounselor = 1, { m_AccessLevel = AccessLevel.Counselor; break; } case (AccessLevel)2: //OldGameMaster = 2, { m_AccessLevel = AccessLevel.GameMaster; break; } case (AccessLevel)3: //OldSeer = 3, { m_AccessLevel = AccessLevel.Seer; break; } case (AccessLevel)4: //OldAdministrator = 4, { m_AccessLevel = AccessLevel.Administrator; break; } } } m_Skills = new Skills(this, reader); int itemCount = reader.ReadInt32(); m_Items = new ArrayList(itemCount); for (int i = 0; i < itemCount; ++i) { Item item = reader.ReadItem(); if (item != null) m_Items.Add(item); } m_Player = reader.ReadBool(); m_Title = reader.ReadString(); m_Profile = reader.ReadString(); m_ProfileLocked = reader.ReadBool(); if (version <= 18) { /*m_LightLevel =*/ reader.ReadInt(); /*m_TotalGold =*/ reader.ReadInt(); /*m_TotalWeight =*/ reader.ReadInt(); } m_AutoPageNotify = reader.ReadBool(); m_LogoutLocation = reader.ReadPoint3D(); m_LogoutMap = reader.ReadMap(); m_StrLock = (StatLockType)reader.ReadByte(); m_DexLock = (StatLockType)reader.ReadByte(); m_IntLock = (StatLockType)reader.ReadByte(); m_StatMods = new ArrayList(); if (reader.ReadBool()) { m_StuckMenuUses = new DateTime[reader.ReadInt32()]; for (int i = 0; i < m_StuckMenuUses.Length; ++i) { m_StuckMenuUses[i] = reader.ReadDateTime(); } } else { m_StuckMenuUses = null; } if (m_Player && m_Map != Map.Internal) { m_LogoutLocation = m_Location; m_LogoutMap = m_Map; m_Map = Map.Internal; } if (m_Map != null) m_Map.OnEnter(this); if (m_Criminal) { if (m_ExpireCriminal == null) m_ExpireCriminal = new ExpireCriminalTimer(this); m_ExpireCriminal.Start(); } if (ShouldCheckStatTimers) CheckStatTimers(); if (!m_Player && m_Dex <= 100 && m_CombatTimer != null) m_CombatTimer.Priority = TimerPriority.FiftyMS; else if (m_CombatTimer != null) m_CombatTimer.Priority = TimerPriority.EveryTick; m_Region = Region.Find(m_Location, m_Map); m_Region.InternalEnter(this); //UpdateResistances(); break; } } //Pix: special logic to ensure the DefensiveSpell lock in m_Actions exists if it should //Note protection is a different beast since there are timers that control // BeginAction/EndAction -- protection effects aren't serialized. if (MagicDamageAbsorb > 0 || MeleeDamageAbsorb > 0) { BeginAction(typeof(DefensiveSpell)); } }
public AllianceChatEventArgs(Mobile mob, BaseGuild guild, string speech) { m_Mobile = mob; m_Guild = guild; m_Speech = speech; }