Ejemplo n.º 1
0
        public AuctionHouseObject GetAuctionsMap(uint factionTemplateId)
        {
            if (WorldConfig.GetBoolValue(WorldCfg.AllowTwoSideInteractionAuction))
            {
                return(mNeutralAuctions);
            }

            // teams have linked auction houses
            FactionTemplateRecord uEntry = CliDB.FactionTemplateStorage.LookupByKey(factionTemplateId);

            if (uEntry == null)
            {
                return(mNeutralAuctions);
            }
            else if ((uEntry.FactionGroup & (int)FactionMasks.Alliance) != 0)
            {
                return(mAllianceAuctions);
            }
            else if ((uEntry.FactionGroup & (int)FactionMasks.Horde) != 0)
            {
                return(mHordeAuctions);
            }
            else
            {
                return(mNeutralAuctions);
            }
        }
Ejemplo n.º 2
0
        public AuctionHouseRecord GetAuctionHouseEntry(uint factionTemplateId, ref uint houseId)
        {
            uint houseid = 7; // goblin auction house

            if (!WorldConfig.GetBoolValue(WorldCfg.AllowTwoSideInteractionAuction))
            {
                // FIXME: found way for proper auctionhouse selection by another way
                // AuctionHouse.dbc have faction field with _player_ factions associated with auction house races.
                // but no easy way convert creature faction to player race faction for specific city
                switch (factionTemplateId)
                {
                case 12: houseid = 1; break;     // human

                case 29: houseid = 6; break;     // orc, and generic for horde

                case 55: houseid = 2; break;     // dwarf, and generic for alliance

                case 68: houseid = 4; break;     // undead

                case 80: houseid = 3; break;     // n-elf

                case 104: houseid = 5; break;    // trolls

                case 120: houseid = 7; break;    // booty bay, neutral

                case 474: houseid = 7; break;    // gadgetzan, neutral

                case 855: houseid = 7; break;    // everlook, neutral

                case 1604: houseid = 6; break;   // b-elfs,

                default:                         // for unknown case
                {
                    FactionTemplateRecord u_entry = CliDB.FactionTemplateStorage.LookupByKey(factionTemplateId);
                    if (u_entry == null)
                    {
                        houseid = 7;         // goblin auction house
                    }
                    else if ((u_entry.FactionGroup & (int)FactionMasks.Alliance) != 0)
                    {
                        houseid = 1;         // human auction house
                    }
                    else if ((u_entry.FactionGroup & (int)FactionMasks.Horde) != 0)
                    {
                        houseid = 6;         // orc auction house
                    }
                    else
                    {
                        houseid = 7;         // goblin auction house
                    }
                    break;
                }
                }
            }

            houseId = houseid;

            return(CliDB.AuctionHouseStorage.LookupByKey(houseid));
        }
Ejemplo n.º 3
0
        public override bool GossipHello(Player player)
        {
            me.UseDoorOrButton();
            int Random = (int)(RandomHelper.Rand32() % (CreatureIds.PrisonEntry.Length / sizeof(uint)));

            Creature creature = player.SummonCreature(CreatureIds.PrisonEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAbsoluteAngle(player), TempSummonType.TimedDespawnOutOfCombat, 30000);

            if (creature)
            {
                if (!creature.IsHostileTo(player))
                {
                    FactionTemplateRecord pFaction = creature.GetFactionTemplateEntry();
                    if (pFaction != null)
                    {
                        uint spellId = 0;

                        switch (pFaction.Faction)
                        {
                        case 1011:
                            spellId = SpellIds.RepLc;
                            break;

                        case 935:
                            spellId = SpellIds.RepShat;
                            break;

                        case 942:
                            spellId = SpellIds.RepCe;
                            break;

                        case 933:
                            spellId = SpellIds.RepCon;
                            break;

                        case 989:
                            spellId = SpellIds.RepKt;
                            break;

                        case 970:
                            spellId = SpellIds.RepSpor;
                            break;
                        }

                        if (spellId != 0)
                        {
                            creature.CastSpell(player, spellId, false);
                        }
                        else
                        {
                            Log.outError(LogFilter.Scripts, $"go_ethereum_prison summoned Creature (entry {creature.GetEntry()}) but faction ({creature.GetFaction()}) are not expected by script.");
                        }
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
        public void SetVisible(FactionTemplateRecord factionTemplateEntry)
        {
            if (factionTemplateEntry.Faction == 0)
            {
                return;
            }

            var factionEntry = CliDB.FactionStorage.LookupByKey(factionTemplateEntry.Faction);

            if (factionEntry.Id != 0)
            {
                // Never show factions of the opposing team
                if (!Convert.ToBoolean(factionEntry.ReputationRaceMask[1] & _player.GetRaceMask()) && factionEntry.ReputationBase[1] == Reputation_Bottom)
                {
                    SetVisible(factionEntry);
                }
            }
        }
Ejemplo n.º 5
0
        public override bool OnGossipHello(Player player, GameObject go)
        {
            go.UseDoorOrButton();
            int      Random   = (int)(RandomHelper.Rand32() % (GameobjectConst.NpcPrisonEntry.Length / sizeof(uint)));
            Creature creature = player.SummonCreature(GameobjectConst.NpcPrisonEntry[Random], go.GetPositionX(), go.GetPositionY(), go.GetPositionZ(), go.GetAngle(player), TempSummonType.TimedDespawnOOC, 30000);

            if (creature)
            {
                if (!creature.IsHostileTo(player))
                {
                    FactionTemplateRecord pFaction = creature.GetFactionTemplateEntry();
                    if (pFaction != null)
                    {
                        uint Spell = 0;

                        switch (pFaction.Faction)
                        {
                        case 1011: Spell = GameobjectConst.SpellRepLc; break;

                        case 935: Spell = GameobjectConst.SpellRepShat; break;

                        case 942: Spell = GameobjectConst.SpellRepCe; break;

                        case 933: Spell = GameobjectConst.SpellRepCon; break;

                        case 989: Spell = GameobjectConst.SpellRepKt; break;

                        case 970: Spell = GameobjectConst.SpellRepSpor; break;
                        }

                        if (Spell != 0)
                        {
                            creature.CastSpell(player, Spell, false);
                        }
                        else
                        {
                            Log.outError(LogFilter.Scripts, "go_ethereum_prison summoned Creature (entry {0}) but faction ({1}) are not expected by script.", creature.GetEntry(), creature.getFaction());
                        }
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 6
0
        public bool CanUseBattlegroundObject(GameObject gameobject)
        {
            // It is possible to call this method with a null pointer, only skipping faction check.
            if (gameobject)
            {
                FactionTemplateRecord playerFaction = GetFactionTemplateEntry();
                FactionTemplateRecord faction       = CliDB.FactionTemplateStorage.LookupByKey(gameobject.GetUInt32Value(GameObjectFields.Faction));

                if (playerFaction != null && faction != null && !playerFaction.IsFriendlyTo(faction))
                {
                    return(false);
                }
            }

            // BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet
            // Note: Mount, stealth and invisibility will be removed when used
            return(!isTotalImmune() &&                                     // Damage immune
                   !HasAura(BattlegroundConst.SpellRecentlyDroppedFlag) && // Still has recently held flag debuff
                   IsAlive());                                             // Alive
        }
Ejemplo n.º 7
0
 public ReputationRank GetForcedRankIfAny(FactionTemplateRecord factionTemplateEntry)
 {
     return(GetForcedRankIfAny(factionTemplateEntry.Faction));
 }
Ejemplo n.º 8
0
        public void UpdateHostileAreaState(AreaTableRecord area)
        {
            ZonePVPTypeOverride overrideZonePvpType = GetOverrideZonePVPType();

            pvpInfo.IsInHostileArea = false;

            if (area.IsSanctuary()) // sanctuary and arena cannot be overriden
            {
                pvpInfo.IsInHostileArea = false;
            }
            else if (area.HasFlag(AreaFlags.Arena))
            {
                pvpInfo.IsInHostileArea = true;
            }
            else if (overrideZonePvpType == ZonePVPTypeOverride.None)
            {
                if (area != null)
                {
                    if (InBattleground() || area.HasFlag(AreaFlags.Combat) || (area.PvpCombatWorldStateID != -1 && Global.WorldMgr.GetWorldState((WorldStates)area.PvpCombatWorldStateID) != 0))
                    {
                        pvpInfo.IsInHostileArea = true;
                    }
                    else if (Global.WorldMgr.IsPvPRealm() || area.HasFlag(AreaFlags.Unk3))
                    {
                        if (area.HasFlag(AreaFlags.ContestedArea))
                        {
                            pvpInfo.IsInHostileArea = Global.WorldMgr.IsPvPRealm();
                        }
                        else
                        {
                            FactionTemplateRecord factionTemplate = GetFactionTemplateEntry();
                            if (factionTemplate == null || factionTemplate.FriendGroup.HasAnyFlag(area.FactionGroupMask))
                            {
                                pvpInfo.IsInHostileArea = false;
                            }
                            else if (factionTemplate.EnemyGroup.HasAnyFlag(area.FactionGroupMask))
                            {
                                pvpInfo.IsInHostileArea = true;
                            }
                            else
                            {
                                pvpInfo.IsInHostileArea = Global.WorldMgr.IsPvPRealm();
                            }
                        }
                    }
                }
            }
            else
            {
                switch (overrideZonePvpType)
                {
                case ZonePVPTypeOverride.Friendly:
                    pvpInfo.IsInHostileArea = false;
                    break;

                case ZonePVPTypeOverride.Hostile:
                case ZonePVPTypeOverride.Contested:
                case ZonePVPTypeOverride.Combat:
                    pvpInfo.IsInHostileArea = true;
                    break;

                default:
                    break;
                }
            }

            // Treat players having a quest flagging for PvP as always in hostile area
            pvpInfo.IsHostile = pvpInfo.IsInHostileArea || HasPvPForcingQuest();
        }