Example #1
0
		public DistillationContext()
		{
			m_LastGroup = Group.WheatBased;
			m_LastLiquor = Liquor.None;
			m_MakeStrong = false;
			m_Mark = true;
			m_Label = null;
		}
Example #2
0
		public DistillationContext(GenericReader reader)
		{
			int version = reader.ReadInt();
			
			m_LastGroup = (Group)reader.ReadInt();
			m_LastLiquor = (Liquor)reader.ReadInt();
			m_MakeStrong = reader.ReadBool();
			m_Mark = reader.ReadBool();
			m_Label = reader.ReadString();
		}
Example #3
0
		public CraftDefinition(Group group, Liquor liquor, Type[] ingredients, int[] amounts, TimeSpan matureperiod)
		{
			m_Group = group;
			m_Liquor = liquor;
			m_Ingredients = ingredients;
			m_Amounts = amounts;
			m_MaturationDuration = matureperiod;
			
			m_Labels = new int[m_Ingredients.Length];
			
			for(int i = 0; i < m_Ingredients.Length; i++)
			{
				Type type = m_Ingredients[i];
				
				if(type == typeof(Yeast))
					m_Labels[i] = 1150453;
				else if (type == typeof(WheatWort))
					m_Labels[i] = 1150275;
				else if (type == typeof(PewterBowlOfCorn))
					m_Labels[i] = 1025631;
                else if (type == typeof(PewterBowlOfPotatos))
					m_Labels[i] = 1025634;
				else if (type == typeof(TribalBerry))
					m_Labels[i] = 1040001;
				else if (type == typeof(HoneydewMelon))
					m_Labels[i] = 1023189;
				else if (type == typeof(JarHoney))
					m_Labels[i] = 1022540;
				else if (type == typeof(Pitcher))
				{
					if(m_Liquor == Liquor.Brandy)
						m_Labels[i] = 1028091;    	// pitcher of wine
					else
						m_Labels[i] = 1024088;		// pitcher of water
				}
				else if (type == typeof(Dates))
					m_Labels[i] = 1025927;
				else if (type == typeof(PewterBowlOfCorn))
					m_Labels[i] = 1025631;
				else
				{
					Item item = Loot.Construct(type);
					if(item != null)
					{
						m_Labels[i] = item.LabelNumber;
						item.Delete();
					}
				}
				
			}
		}
Example #4
0
		public void QuitGroup()
		{
			if ( group == null )
				return;
			group.Quit( this );
			group = null;
		}
Example #5
0
		void GroupAccept()
		{
			for(int t = 0;t < World.PendingGroup.Count;t+=2 )
			{
				if ( World.PendingGroup[ t ] == this )
				{
					Character ch = (Character)World.PendingGroup[ t + 1 ];
					group = ch.GroupMembers;
					group.Add( this );
					World.PendingGroup.Remove( ch );
					World.PendingGroup.Remove( this );
				}
			}
		}
Example #6
0
		void GroupInvite( string name )
		{
			foreach( Character c in account.PlayersNear )
				if ( c.Name == name )
				{
					int offset = 4;
					Converter.ToBytes( Name, tempBuff, ref offset );
					Converter.ToBytes( (byte)0, tempBuff, ref offset );
					c.Send( OpCodes.SMSG_GROUP_INVITE, tempBuff, offset );
					offset = 4;
					Converter.ToBytes( 1, tempBuff, ref offset );
					Converter.ToBytes( Name, tempBuff, ref offset );
					Converter.ToBytes( (byte)0, tempBuff, ref offset );
					Converter.ToBytes( 2, tempBuff, ref offset );
					Converter.ToBytes( 3, tempBuff, ref offset );
					c.Send( OpCodes.SMSG_PARTY_COMMAND_RESULT, tempBuff, offset );		
					if ( group == null || group.Count == 0 )
					{
						group = new Group();
						group.Add( this, 0x101 );
					}
					World.PendingGroup.Add( c );
					World.PendingGroup.Add( this );
					return;
				}
		}
		// all mob factions are set up here
		public static new void Initialize()
		{
			// stress testing
			//Timer.DelayCall( TimeSpan.FromSeconds(15),TimeSpan.FromSeconds(15), new TimerCallback( XmlSpawner.XmlTrace_OnCommand ) );

			CommandSystem.Register("VerboseMobFactions", AccessLevel.Player, new CommandEventHandler(VerboseMobFactions_OnCommand));
			CommandSystem.Register("AddAllMobFactions", AccessLevel.Administrator, new CommandEventHandler(AddAllMobFactions_OnCommand));
			CommandSystem.Register("RemoveAllMobFactions", AccessLevel.Administrator, new CommandEventHandler(RemoveAllMobFactions_OnCommand));
			CommandSystem.Register("CheckMobFactions", AccessLevel.Player, new CommandEventHandler(CheckMobFactions_OnCommand));

			// set up all of the mob factions

			Group PlayerGroup = new Group(GroupTypes.Player);
			Group UndeadGroup = new Group(GroupTypes.Undead);
			Group HumanoidGroup = new Group(GroupTypes.Humanoid);
			Group ArachnidGroup = new Group(GroupTypes.Arachnid);
			Group ReptilianGroup = new Group(GroupTypes.Reptilian);
			Group ElementalGroup = new Group(GroupTypes.Elemental);
			Group AbyssGroup = new Group(GroupTypes.Abyss);
			Group DragonLordsGroup = new Group();
			Group NecroMastersGroup = new Group(GroupTypes.NecroMasters);
			Group FairieGroup = new Group(GroupTypes.Fairie);
			Group PlantGroup = new Group(GroupTypes.Plant);
			Group UnderworldGroup = new Group(GroupTypes.Underworld);

			// these groups have Members and opponents lists that determine which mobs give faction as well as the multipliers for the
			// amount of faction gained and lost by killing
			PlayerGroup.Opponents = new Group[] {ArachnidGroup, HumanoidGroup, UndeadGroup, ReptilianGroup, ElementalGroup, AbyssGroup};
			PlayerGroup.OpponentGain = new double [] { 2,        1,              2,          2,              1,              4 };    // scale factor for faction gained by opponent groups
			PlayerGroup.Allies = new Group[] { PlayerGroup, FairieGroup };
			PlayerGroup.AllyLoss = new double [] { 30.0,    10 };          // scale factor for faction lost for killing within group
			PlayerGroup.Members = new ArrayList(PlayerMembers);

			UndeadGroup.Opponents = new Group[] {HumanoidGroup, PlayerGroup, FairieGroup};
			UndeadGroup.OpponentGain = new double [] {  1,       0.1,        0.5 };
			UndeadGroup.Allies = new Group[] { UndeadGroup, AbyssGroup };
			UndeadGroup.AllyLoss = new double [] {1.2,      0.4};
			UndeadGroup.Members = new ArrayList(UndeadMembers);
			UndeadGroup.Members.Add(new XmlDynamicFaction("Undead"));

			HumanoidGroup.Opponents = new Group[] {UndeadGroup, PlayerGroup, PlantGroup};
			HumanoidGroup.OpponentGain = new double [] {  1,       0.05,     0.5 };
			HumanoidGroup.Allies = new Group[] { HumanoidGroup };
			HumanoidGroup.AllyLoss = new double [] {1.2};
			HumanoidGroup.Members = new ArrayList(HumanoidMembers);
			HumanoidGroup.Members.Add(new XmlDynamicFaction("Humanoid"));

			ArachnidGroup.Opponents = new Group[] {ReptilianGroup, PlayerGroup, FairieGroup};
			ArachnidGroup.OpponentGain = new double [] {  1,       0.15,        0.3 };
			ArachnidGroup.Allies = new Group[] { ArachnidGroup, PlantGroup };
			ArachnidGroup.AllyLoss = new double [] {1.2,        0.5 };
			ArachnidGroup.Members = new ArrayList(ArachnidMembers);
			ArachnidGroup.Members.Add(new XmlDynamicFaction("Arachnid"));

			ReptilianGroup.Opponents = new Group[] {ArachnidGroup, PlayerGroup};
			ReptilianGroup.OpponentGain = new double [] {  1,       0.1 };
			ReptilianGroup.Allies = new Group[] { ReptilianGroup };
			ReptilianGroup.AllyLoss = new double [] {1.2};
			ReptilianGroup.Members = new ArrayList(ReptilianMembers);
			ReptilianGroup.Members.Add(new XmlDynamicFaction("Reptilian"));

			ElementalGroup.Opponents = new Group[] {AbyssGroup, PlayerGroup, PlantGroup};
			ElementalGroup.OpponentGain = new double [] {  1,       0.05,    0.5 };
			ElementalGroup.Allies = new Group[] { ElementalGroup };
			ElementalGroup.AllyLoss = new double [] {1.2};
			ElementalGroup.Members = new ArrayList(ElementalMembers);
			ElementalGroup.Members.Add(new XmlDynamicFaction("Elemental"));

			AbyssGroup.Opponents = new Group[] {ElementalGroup, PlayerGroup, FairieGroup};
			AbyssGroup.OpponentGain = new double [] {  1,       0.2,           1 };
			AbyssGroup.Allies = new Group[] { AbyssGroup, UndeadGroup };
			AbyssGroup.AllyLoss = new double [] {1.2,      0.4};
			AbyssGroup.Members = new ArrayList(AbyssMembers);
			AbyssGroup.Members.Add(new XmlDynamicFaction("Abyss"));

			FairieGroup.Opponents = new Group[] {ArachnidGroup, UndeadGroup, AbyssGroup};
			FairieGroup.OpponentGain = new double [] {  0.5,       0.7,       1 };
			FairieGroup.Allies = new Group[] { FairieGroup, PlayerGroup };
			FairieGroup.AllyLoss = new double [] { 1.2,     0.5};
			FairieGroup.Members = new ArrayList(FairieMembers);
			FairieGroup.Members.Add(new XmlDynamicFaction("Fairie"));

			PlantGroup.Opponents = new Group[] {ElementalGroup, HumanoidGroup};
			PlantGroup.OpponentGain = new double [] {  0.5,       0.7 };
			PlantGroup.Allies = new Group[] { PlantGroup };
			PlantGroup.AllyLoss = new double [] { 1.2 };
			PlantGroup.Members = new ArrayList(PlantMembers);
			PlantGroup.Members.Add(new XmlDynamicFaction("Plant"));
            
			UnderworldGroup.Opponents = new Group[] { AbyssGroup, HumanoidGroup};
			UnderworldGroup.OpponentGain = new double [] {  0.5,       0.7 };
			UnderworldGroup.Allies = new Group[] { UnderworldGroup, UndeadGroup, ElementalGroup };
			UnderworldGroup.AllyLoss = new double [] { 1.2,          1.0,        1.0};
			UnderworldGroup.Members = new ArrayList(UnderworldMembers);
			UnderworldGroup.Members.Add(new XmlDynamicFaction("Underworld"));

			// this group does not have a predefined set of members but instead uses only the dynamic faction system to determine whether a mob
			// is a member of the group
			NecroMastersGroup.Members = new ArrayList();
			NecroMastersGroup.Members.Add(new XmlDynamicFaction("NecroMasters"));
			NecroMastersGroup.Allies = new Group[] { NecroMastersGroup };
			NecroMastersGroup.AllyLoss = new double [] { 1 };

			// Note that the groups do not have to have opponents or members and therefore do not have to gain/lose faction by killing mobs
			// these could be used to maintain factions that are set by quests or other events
			DragonLordsGroup.GroupType = GroupTypes.DragonLords;

			// only have to list groups here that gain/lose faction through killing mobs and/or should be actively checked for AI related functions
			// such as target acquisition, taming, mob control etc.  
			// You can leave out groups that are intended to be passive placeholders for faction, such as the DragonLordsGroup example.

			// stress testing
			//m_KillGroups = new Group[1000];
			//for(int i=0;i<1000;i++) m_KillGroups[i] = AbyssGroup;

			m_KillGroups = new Group[]
			{
				PlayerGroup,
				UndeadGroup,
				HumanoidGroup,
				ArachnidGroup,
				ReptilianGroup,
				ElementalGroup,
				AbyssGroup,
				FairieGroup,
				PlantGroup,
				UnderworldGroup,
				NecroMastersGroup
			};

		}
Example #8
0
 /// <summary>
 /// Sets the Group which the client will be part of
 /// </summary>
 /// <param name="group">The group to make the client part of</param>
 public void SetGroup(Group group)
 {
     this.group = group;
     if (!this.group.GetClients().Contains(this))
     {
         this.group.AddClient(this);
     }
 }
Example #9
0
		public static Liquor GetFirstLiquor(Group group)
		{
			foreach(CraftDefinition def in m_CraftDefs)
			{
				if(def.Group == group)
					return def.Liquor;
			}
			
			return Liquor.Whiskey;
		}
Example #10
0
		public static int GetLabel(Group group)
		{
			if(group == Group.Other)
				return 1077435;
				
			return 1150736 + (int)group;
		}
Example #11
0
		public static CraftDefinition GetDefinition(Liquor liquor, Group group)
		{
			foreach(CraftDefinition def in m_CraftDefs)
			{
				if(def.Liquor == liquor && def.Group == group)
					return def;
			}
			
			return GetFirstDefForGroup(group);
		}
Example #12
0
        public static CraftDefinition GetFirstDefForGroup(Group group)
        {
            foreach (CraftDefinition def in m_CraftDefs)
            {
                if (def.Group == group)
                    return def;
            }

            return null;
        }