Ejemplo n.º 1
0
        //STATIC PART
        public static void Configure()
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("## Réputation configuration ##");
            FactionsBank = new Dictionary <FactionEnum, BaseFaction>();
            string        space   = "Server.Mobiles";
            List <string> classes = NubiaHelper.getAllClasses(space);

            foreach (string clstr in classes)
            {
                // Console.WriteLine(" - "+clstr);
                Type cltype = Type.GetType(space + "." + clstr);
                // Console.WriteLine("Type: " + cltype);
                if (cltype != null)
                {
                    if (cltype.IsSubclassOf(typeof(BaseFaction)))
                    {
                        try
                        {
                            BaseFaction fac = (BaseFaction)cltype.GetConstructor(Type.EmptyTypes).Invoke(new object[0]);
                            FactionsBank.Add(fac.Faction, fac);
                            Console.WriteLine("- Faction: " + fac.Name + " (FactionEnum." + fac.Faction.ToString() + ")");
                            fac = null;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                    }
                }
            }
            Console.ResetColor();
        }
Ejemplo n.º 2
0
        public void IncReputation(FactionEnum fe, int amount)
        {
            BaseFaction faction = getFaction(fe);

            if (mReputations.ContainsKey(fe) && faction != null)
            {
                mReputations[fe] += amount;
            }
        }
Ejemplo n.º 3
0
        public override bool OnBeforeDeath()
        {
            //XP Gains

            /*  if (AI != AIType.AI_Animal)
             * {*/
            foreach (AggressorInfo ainf in Aggressors)
            {
                if (ainf.Attacker is NubiaPlayer)
                {
                    NubiaPlayer agg = ainf.Attacker as NubiaPlayer;
                    int         xp  = 30;
                    int         dif = Niveau - agg.Niveau;
                    if (dif < -5)
                    {
                        dif = -5;
                    }
                    else if (dif > 5)
                    {
                        dif = 5;
                    }
                    xp += dif * dif;
                    if (IsElite)
                    {
                        xp *= 10;
                    }
                    xp *= 10;
                    agg.GiveXP(xp);

                    if (mFaction != FactionEnum.None)
                    {
                        agg.ReputationStack.IncReputation(mFaction, -5);

                        for (int f = 0; f < (int)FactionEnum.Maximum; f++)
                        {
                            BaseFaction faction = FactionHelper.getFaction((FactionEnum)f);
                            if (faction != null)
                            {
                                for (int e = 0; e < faction.Enemies.Length; e++)
                                {
                                    if (faction.Enemies[e] == mFaction)
                                    {
                                        agg.ReputationStack.IncReputation(faction.Faction, 1);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            //  }
            return(base.OnBeforeDeath());
        }
Ejemplo n.º 4
0
        public int getReputation(FactionEnum fe)
        {
            if (fe == FactionEnum.None)
            {
                return(0);
            }
            BaseFaction fac = getFaction(fe);

            if (fac != null)
            {
                return(mReputations[fac.Faction] + fac.ComputeBonus(mOwner));
            }
            return(0);
        }
Ejemplo n.º 5
0
        public static bool friendOf(FactionEnum fac1, FactionEnum fac2)
        {
            BaseFaction factionA = getFaction(fac1);

            if (factionA != null)
            {
                for (int i = 0; i < factionA.Allys.Length; i++)
                {
                    if (factionA.Allys[i] == fac2)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }