Example #1
14
        public bool AddMember(ObjectGuid playerGuid)
        {
            string playerName;
            Class  playerClass;

            // Check if arena team is full (Can't have more than type * 2 players)
            if (GetMembersSize() >= GetArenaType() * 2)
            {
                return(false);
            }

            // Get player name and class either from db or character cache
            CharacterCacheEntry characterInfo;
            Player player = Global.ObjAccessor.FindPlayer(playerGuid);

            if (player)
            {
                playerClass = player.GetClass();
                playerName  = player.GetName();
            }
            else if ((characterInfo = Global.CharacterCacheStorage.GetCharacterCacheByGuid(playerGuid)) != null)
            {
                playerName  = characterInfo.Name;
                playerClass = characterInfo.ClassId;
            }
            else
            {
                return(false);
            }

            // Check if player is already in a similar arena team
            if ((player && player.GetArenaTeamId(GetSlot()) != 0) || Global.CharacterCacheStorage.GetCharacterArenaTeamIdByGuid(playerGuid, GetArenaType()) != 0)
            {
                Log.outDebug(LogFilter.Arena, "Arena: {0} {1} already has an arena team of type {2}", playerGuid.ToString(), playerName, GetArenaType());
                return(false);
            }

            // Set player's personal rating
            uint personalRating = 0;

            if (WorldConfig.GetIntValue(WorldCfg.ArenaStartPersonalRating) > 0)
            {
                personalRating = WorldConfig.GetUIntValue(WorldCfg.ArenaStartPersonalRating);
            }
            else if (GetRating() >= 1000)
            {
                personalRating = 1000;
            }

            // Try to get player's match maker rating from db and fall back to config setting if not found
            PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MATCH_MAKER_RATING);

            stmt.AddValue(0, playerGuid.GetCounter());
            stmt.AddValue(1, GetSlot());
            SQLResult result = DB.Characters.Query(stmt);

            uint matchMakerRating;

            if (!result.IsEmpty())
            {
                matchMakerRating = result.Read <ushort>(0);
            }
            else
            {
                matchMakerRating = WorldConfig.GetUIntValue(WorldCfg.ArenaStartMatchmakerRating);
            }

            // Remove all player signatures from other petitions
            // This will prevent player from joining too many arena teams and corrupt arena team data integrity
            //Player.RemovePetitionsAndSigns(playerGuid, GetArenaType());

            // Feed data to the struct
            ArenaTeamMember newMember = new();

            newMember.Name             = playerName;
            newMember.Guid             = playerGuid;
            newMember.Class            = (byte)playerClass;
            newMember.SeasonGames      = 0;
            newMember.WeekGames        = 0;
            newMember.SeasonWins       = 0;
            newMember.WeekWins         = 0;
            newMember.PersonalRating   = (ushort)personalRating;
            newMember.MatchMakerRating = (ushort)matchMakerRating;

            Members.Add(newMember);
            Global.CharacterCacheStorage.UpdateCharacterArenaTeamId(playerGuid, GetSlot(), GetId());

            // Save player's arena team membership to db
            stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ARENA_TEAM_MEMBER);
            stmt.AddValue(0, teamId);
            stmt.AddValue(1, playerGuid.GetCounter());
            DB.Characters.Execute(stmt);

            // Inform player if online
            if (player)
            {
                player.SetInArenaTeam(teamId, GetSlot(), GetArenaType());
                player.SetArenaTeamIdInvited(0);

                // Hide promote/remove buttons
                if (CaptainGuid != playerGuid)
                {
                    player.SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType.Member, 1);
                }
            }

            Log.outDebug(LogFilter.Arena, "Player: {0} [{1}] joined arena team type: {2} [Id: {3}, Name: {4}].", playerName, playerGuid.ToString(), GetArenaType(), GetId(), GetName());

            return(true);
        }
Example #2
0
 public ani_StoreBaseInfo()
 {
     RegisterId = ObjectGuid.InvalidObjectGuid;
     RestockBuyMode = true;
     RestockCraftable = false;
     CooldownInMinutes = 60;
 }
Example #3
0
        private bool CustomProcessClick(ScenePickArgs eventArgs)
        {
            switch (eventArgs.mObjectType)
            {
                case ScenePickObjectType.Terrain:
                case ScenePickObjectType.Floor:
                case ScenePickObjectType.RoadStreet:
                case ScenePickObjectType.RoadSidewalk:
                case ScenePickObjectType.WaterPond:
                case ScenePickObjectType.WaterSea:
                case ScenePickObjectType.WaterPool:
                case ScenePickObjectType.WaterFountain:
                    if ((Bin.PlacementHousehold == null) && (Bin.PlacementLot == null))
                    {
                        return GameObjectEx.OnPick(Terrain.Singleton, eventArgs.mMouseEvent, eventArgs.AsGameObjectHit());
                    }
                    break;
                case ScenePickObjectType.Object:
                case ScenePickObjectType.Sim:
                case ScenePickObjectType.Wall:
                    ObjectGuid guid = ObjectGuid.InvalidObjectGuid;
                    if ((eventArgs.mObjectType == ScenePickObjectType.Object) || (eventArgs.mObjectType == ScenePickObjectType.Sim))
                    {
                        guid = new ObjectGuid(eventArgs.mObjectId);
                    }
                    else if (eventArgs.mObjectType == ScenePickObjectType.Wall)
                    {
                        guid = LotManager.GetLotObjectGuid(eventArgs.mObjectId);
                    }

                    IScriptProxy proxy = Simulator.GetProxy(guid);
                    if (proxy != null)
                    {
                        IObjectUI target = proxy.Target as IObjectUI;
                        if (target != null)
                        {
                            Lot lot = target as Lot;
                            if (lot != null)
                            {
                                return OnPickLot(lot, eventArgs.mMouseEvent, eventArgs.AsGameObjectHit());
                            }
                            else
                            {
                                GameObject obj = target as GameObject;
                                if (obj != null)
                                {
                                    return GameObjectEx.OnPick(obj, eventArgs.mMouseEvent, eventArgs.AsGameObjectHit());
                                }
                            }
                        }
                    }
                    break;
            }

            return false;
        }
            public DoorSettings(ObjectGuid guid)
            {
                mGUID = guid;

                Door door = GameObject.GetObject(guid) as Door;
                if (door != null)
                {
                    RegisterRoomListeners(door.LotCurrent);
                }
            }
Example #5
0
 protected static void OnSimChanged(ObjectGuid id)
 {
     try
     {
         Common.FunctionTask.Perform(OnUpdateMagicBar);
     }
     catch (Exception e)
     {
         Common.Exception("OnSimChanged", e);
     }
 }
        public Dictionary<string, List<Quality>> GetDisplaySettingsForSlot(ObjectGuid guid, int i)
        {
            if (HasSettings(guid))
            {
                if (SlotHasSettings(guid, i))
                {
                    return mDisplayRestockSettings[guid][i];
                }
            }

            return null;
        }
Example #7
0
        public override void RunEvent(Career c)
        {
            ObjectGuid simObjectId = new ObjectGuid();
            if (c.OwnerDescription.CreatedSim != null)
            {
                simObjectId = c.OwnerDescription.CreatedSim.ObjectId;
            }
            base.Display(LocalizeString(c.OwnerDescription, "ImpromptuMeetingEvent", new object[] { c.OwnerDescription }), simObjectId, c);

            Business business = OmniCareer.Career<Business>(c);
            if (business != null)
            {
                business.MeetingsHeldToday++;
            }
        }
Example #8
0
        public override void ProcessClick(ScenePickArgs eventArgs)
        {
            try
            {
                if (((eventArgs.mObjectType != ScenePickObjectType.None) && !WasMouseDragged(eventArgs)) && ((eventArgs.mMouseEvent.MouseKey != MouseKeys.kMouseRight) || ((eventArgs.mMouseEvent.Modifiers & Modifiers.kModifierMaskControl) == Modifiers.kModifierMaskNone)))
                {
                    bool flag = false;
                    if ((eventArgs.mObjectType == ScenePickObjectType.Object) || (eventArgs.mObjectType == ScenePickObjectType.Sim))
                    {
                        ObjectGuid objectId = new ObjectGuid(eventArgs.mObjectId);
                        IScriptProxy proxy = Simulator.GetProxy(objectId);
                        if (proxy != null)
                        {
                            IObjectUI target = proxy.Target as IObjectUI;
                            if (target != null)
                            {
                                Vehicle vehicle = target as Vehicle;
                                if (vehicle != null)
                                {
                                    flag = OnSelect(vehicle, eventArgs.mMouseEvent);
                                }
                                else if (target is Sim)
                                {
                                    flag = OnSelect(target as Sim, eventArgs.mMouseEvent);
                                }
                                else
                                {
                                    flag = target.OnSelect(eventArgs.mMouseEvent);
                                }
                            }
                        }
                    }

                    if (!flag)
                    {
                        CameraController.RequestLerpToTarget(eventArgs.mDisplayPos, 1.5f, false);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("ProcessClick", e);
            }
        }
Example #9
0
 public void OnSimAgeChanged(ObjectGuid objGuid)
 {
     Common.FunctionTask.Perform(PopulateSkewers);
 }
Example #10
0
        public static bool OnPrepareObject(ObjectGuid templateId, ObjectGuid targetId, int index, uint uintVal1, uint uintVal2, ThumbnailSize size, uint prepareType, uint uintVal3)
        {
            try
            {
                switch (((PrepareType)prepareType))
                {
                    case PrepareType.kPrepareHousehold:
                        try
                        {
                            return ThumbnailHelper.PrepareHouseholdForThumbnail(templateId.Value);
                        }
                        catch (Exception e)
                        {
                            Common.DebugException("PrepareHouseholdForThumbnail", e);
                            return false;
                        }

                    case PrepareType.kPrepareSimWithoutTemplate:
                        {
                            ResourceKey outfitKey = new ResourceKey(targetId.Value, (uint)templateId.Value, uintVal1);
                            bool useCasSimBuilder = uintVal2 != 0x0;
                            int num = index;
                            int ghostIndex = -1;
                            if ((outfitKey.TypeId != 0xdea2951c) && ((index < 0x100) || (index > 0x300)))
                            {
                                if (num > -4)
                                {
                                    num = -1;
                                }
                                if ((index >= 6) && (index < 0x20))
                                {
                                    ghostIndex = index - 0x5;
                                }
                            }
                            return ThumbnailHelper.SetupForSimThumbnailUsingSimBuilder(outfitKey, num, ghostIndex, useCasSimBuilder, size);
                        }
                    case PrepareType.kPrepareLot:
                        return ThumbnailHelper.PrepareLotForThumbnail(templateId.Value);

                    case PrepareType.kPreparePromSims:
                        {
                            Sim sim = GameObject.GetObject(new ObjectGuid(templateId.Value)) as Sim;
                            if ((sim == null) || !sim.IsHorse)
                            {
                                // Custom
                                return PreparePromSimsForThumbnail(templateId.Value, targetId.Value);
                            }
                            return ThumbnailHelper.PrepareEquestrianRaceSimsForThumbnail(templateId.Value, targetId.Value);
                        }
                    case PrepareType.kPreparePhotoBoothSims:
                        return ThumbnailHelper.PreparePhotoBoothSimsForThumbnail(templateId.Value, targetId.Value);

                    case PrepareType.kPrepareSimsUsingObject:
                        return ThumbnailHelper.PrepareThumbnailForSimsUsingObject(templateId.Value);

                    case PrepareType.kPrepareSimsForSelfPhoto:
                        return ThumbnailHelper.PrepareSelfPhotoSimsForThumbnail(templateId.Value, targetId.Value);

                    case PrepareType.kPrepareSculptureSim:
                        return ThumbnailHelper.PrepareSculptureSimForThumbnail(targetId.Value);

                    case PrepareType.kPrepareSimsForServoBotArenaPic:
                        return ThumbnailHelper.PrepareServoBotArenaSimsForThumbnail(templateId.Value);
                }

                if ((((templateId.Value == 0x34aeecbL) || (templateId.Value == 0x358b08aL)) || ((templateId.Value == 0x93d84841L) || (templateId.Value == 0x51df2ddL))) || ((templateId.Value == 0x72683c15L) || (templateId.Value == 0x3555ba8L)))
                {
                    CASAgeGenderFlags ageGender = (CASAgeGenderFlags)uintVal1;
                    bool flag2 = uintVal2 != 0x0;
                    ResourceKey partKey = new ResourceKey(targetId.Value, (uint)templateId.Value, uintVal3);
                    if (flag2)
                    {
                        return ThumbnailHelper.SetupForCASThumbnailUsingCASSimbuilder(partKey, index, ageGender, size);
                    }
                    return ThumbnailHelper.SetupForCASThumbnailUsingSeparateSimbuilder(partKey, index, ageGender, size);
                }

                IScriptProxy proxyPreInit = Simulator.GetProxyPreInit(templateId);
                if (proxyPreInit != null)
                {
                    object target = proxyPreInit.Target;
                    if (target == null)
                    {
                        return false;
                    }
                    Sim sim2 = target as Sim;
                    if (sim2 != null)
                    {
                        if ((index >= 6) && (index < 0x20))
                        {
                            if (!sim2.SimDescription.IsEP11Bot)
                            {
                                uint deathTypeFromMoodID = (uint)SimDescription.GetDeathTypeFromMoodID((MoodID)index);
                                World.ObjectSetGhostState(targetId, deathTypeFromMoodID, (uint)sim2.SimDescription.AgeGenderSpecies);
                            }
                            else
                            {
                                World.ObjectSetGhostState(targetId, 0x17, (uint)sim2.SimDescription.AgeGenderSpecies);
                            }
                        }
                        if (sim2.SimDescription.IsVampire)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Vampire, null);
                        }
                        else if (sim2.SimDescription.IsWerewolf)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Werewolf, null);
                        }
                        else if (sim2.SimDescription.IsGenie)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Genie, null);
                        }
                        if (sim2.SimDescription.IsAlien)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Alien, null);
                        }

                        SimOutfit outfit = (sim2.Service == null) ? sim2.SimDescription.GetOutfit(OutfitCategories.Everyday, 0x0) : sim2.SimDescription.GetOutfit(OutfitCategories.Career, 0x0);
                        if ((outfit != null) && ((outfit.AgeGenderSpecies & (CASAgeGenderFlags.Child | CASAgeGenderFlags.Teen | CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Baby | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder)) == sim2.SimDescription.Age))
                        {
                            CASUtils.SetOutfitInGameObject(outfit.Key, targetId);
                            ThumbnailHelper.SelectSimPose(index, outfit.AgeGenderSpecies & (CASAgeGenderFlags.Child | CASAgeGenderFlags.Teen | CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Baby | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder), outfit.AgeGenderSpecies & ((CASAgeGenderFlags)0xcf00), 0x0, false);
                            return true;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnPrepareObject", e);
            }
            return false;
        }
Example #11
0
 public VoiceOffAppend(ObjectGuid guid)
 {
     _guid = guid;
 }
Example #12
0
 public PlayerUnbannedAppend(ObjectGuid moderator, ObjectGuid unbanned)
 {
     _moderator = moderator;
     _unbanned  = unbanned;
 }
Example #13
0
 /// <summary>
 /// A new biota be created taking all of its values from weenie.
 /// </summary>
 public Door(Weenie weenie, ObjectGuid guid) : base(weenie, guid)
 {
     SetEphemeralValues();
 }
        public static RouteAction.ActionResult PerformAction(ObstacleEncounteredRouteInterruptAction ths)
        {
            try
            {
                ths.mRoutingSim.SimRoutingComponent.EnableDynamicFootprint();
                ths.mRoutingSim.SimRoutingComponent.StopPushImmunity();
                if ((ths.mRoutingSim.SimRoutingComponent.UsingStroller && (ths.mRoutingSim.CarryingChildPosture != null)) && (ths.mRoutingSim.CarryingChildPosture.Stroller != null))
                {
                    ths.mRoutingSim.CarryingChildPosture.Stroller.SetPosition(ths.mRoutingSim.CarryingChildPosture.Stroller.Position);
                }

                bool option = ths.mInterruptedPath.GetOption(Route.RouteOption.BlockedByPeople);
                ths.mInterruptedPath.SetOption(Route.RouteOption.BlockedByPeople, true);
                if (ths.mbForceInitialReplan)
                {
                    RoutePlanResult result = ths.mInterruptedPath.Replan();
                    if (!result.Succeeded())
                    {
                        GameObject obj2 = new ObjectGuid(result.mBlockerObjectId).ObjectFromId<GameObject>();
                        ths.mRoutingSim.SimRoutingComponent.PlayRouteFailureIfAppropriate(obj2);
                        return RouteAction.ActionResult.Terminate;
                    }
                }

                /* This is duplicated in StandAndWaitController, I believe it is an EA error since there is no "Exit"
                StateMachineClient client = StateMachineClient.Acquire(ths.mRoutingSim, "StandAndWait");
                client.SetActor("x", ths.mRoutingSim);
                client.SetParameter("isMermaid", OccultMermaid.IsMatureMermaidAndWearingTail(base.mRoutingSim));
                client.EnterState("x", "Enter");
                */

                SpeedTrap.Sleep();
                ths.mnCheckFrequency = 0x1;
                ths.mnCheckOffset = 0x0;
                try
                {
                    StandAndWaitController controller = new StandAndWaitController();
                    controller.AllowZeroCycle = ths.mbAllowZeroCycle;
                    controller.Duration = SimRoutingComponent.DefaultStandAndWaitDuration;
                    controller.OnCycle = ths.StandAndWaitCycleHandler;
                    controller.Run(ths.mRoutingSim);
                }
                catch (SacsErrorException e)
                {
                    Common.DebugException("ObstacleEncounteredRouteInterruptActionEx:PerformAction", e);
                }

                ths.mRoutingSim.SimRoutingComponent.DisableDynamicFootprint();
                if (!ths.mbElectedToExit)
                {
                    ths.mReturnValue = RouteAction.ActionResult.Terminate;
                }

                if (ths.mReturnValue == RouteAction.ActionResult.Terminate)
                {
                    int numObstacles = 0x0;
                    int numPushableObstacles = 0x0;
                    int numWorldObstacles = 0x0;
                    int numStaticObstacles = 0x0;
                    int numReplannableObstacles = 0x0;
                    ObjectGuid[] guidArray = ths.CollectObstacles(ths.mRoutingSim, ref numObstacles, ref numPushableObstacles, ref numReplannableObstacles, ref numStaticObstacles, ref numWorldObstacles);
                    int num6 = numObstacles - numWorldObstacles;
                    if (numObstacles > 0x0)
                    {
                        if ((ths.mRoutingSim.LotCurrent != null) && !ths.mRoutingSim.LotCurrent.IsWorldLot)
                        {
                            if ((num6 == 0x0) && (numWorldObstacles > 0x0))
                            {
                                ths.mRoutingSim.SimRoutingComponent.StartIgnoringObstacles();
                                return RouteAction.ActionResult.ContinueAndFollowPath;
                            }
                            else if ((num6 >= 0x3) && (Sims3.Gameplay.Queries.CountObjects<Sim>(ths.mRoutingSim.Position, 1f) >= 0x4))
                            {
                                ths.mRoutingSim.SimRoutingComponent.StartIgnoringObstacles();
                                return RouteAction.ActionResult.ContinueAndFollowPath;
                            }
                        }
                        else if (numWorldObstacles > 0x0)
                        {
                            ths.mRoutingSim.SimRoutingComponent.StartIgnoringObstacles();
                            return RouteAction.ActionResult.ContinueAndFollowPath;
                        }
                    }
                    else
                    {
                        ths.mRoutingSim.SimRoutingComponent.StartPushImmunity(SimRoutingComponent.OnRouteStartedImmuneToPushesDuration);
                    }

                    if ((!ths.mRoutingSim.HasExitReason(ExitReason.CancelExternal | ExitReason.MidRoutePushRequested) && ths.mInterruptedPath.DoRouteFail) && !ths.mInterruptedPath.PlanResult.Succeeded())
                    {
                        foreach (ObjectGuid guid in guidArray)
                        {
                            GameObject obj3 = guid.ObjectFromId<GameObject>();
                            if (ths.mRoutingSim.SimRoutingComponent.PlayRouteFailureIfAppropriate(obj3))
                            {
                                break;
                            }
                        }
                    }
                }

                ths.mInterruptedPath.SetOption(Route.RouteOption.BlockedByPeople, option);
                return ths.mReturnValue;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception("ObstacleEncounteredRouteInterruptActionEx:PerformAction", e);
                throw;
            }
        }
Example #15
0
 public static int ComputeFinalPriceOnObject(ObjectGuid targetGuid)
 {
     int finalPrice = 0;
     int basePrice = 0;
     GameObject obj2 = GlobalFunctions.ConvertGuidToObject<GameObject>(targetGuid);
     BasePriceFinalPriceDiff(obj2, out finalPrice, out basePrice);
     return finalPrice;
 }
Example #16
0
 /// <summary>
 /// This will clear the ContainerId and PlacementPosition properties.<para />
 /// It will also subtract the EncumbranceVal and Value.
 /// </summary>
 public bool TryRemoveFromInventory(ObjectGuid objectGuid, bool forceSave = false)
 {
     return(TryRemoveFromInventory(objectGuid, out _, forceSave));
 }
Example #17
0
 public TotemAI(Creature creature) : base(creature)
 {
     Cypher.Assert(creature.IsTotem(), $"TotemAI: AI assigned to a no-totem creature ({creature.GetGUID()})!");
     _victimGuid = ObjectGuid.Empty;
 }
Example #18
0
 /// <summary>
 /// This method will check all containers in our possession
 /// in main inventory or any side packs
 /// </summary>
 public WorldObject GetInventoryItem(ObjectGuid objectGuid)
 {
     return(GetInventoryItem(objectGuid, out _));
 }
Example #19
0
        /// <summary>
        /// A new biota be created taking all of its values from weenie.
        /// </summary>
        public Container(Weenie weenie, ObjectGuid guid) : base(weenie, guid)
        {
            SetEphemeralValues();

            InventoryLoaded = true;
        }
Example #20
0
 /// <summary>
 /// This method will check all containers in our possession
 /// in main inventory or any side packs
 /// </summary>
 public bool HasInventoryItem(ObjectGuid objectGuid)
 {
     return(GetInventoryItem(objectGuid) != null);
 }
Example #21
0
        public bool HasLootPermission(ObjectGuid guid)
        {
            PrunePermissions();

            return(LootPermission.ContainsKey(guid));
        }
Example #22
0
 public virtual void SetGUID(ObjectGuid guid, int id = 0)
 {
 }
Example #23
0
        public static bool ShouldShowGoHomeButtonForSim(ObjectGuid simGuid)
        {
            Sims3.Gameplay.UI.HudModel model = HudController.Instance.Model as Sims3.Gameplay.UI.HudModel;

            Sim sim = GameObject.GetObject<Sim>(simGuid);
            if ((sim == null) || (sim != model.mSavedCurrentSim))
            {
                return false;
            }
            if (!sim.SimDescription.ChildOrAbove)
            {
                return false;
            }
            else if (sim.IsAtHome && !sim.IsInPublicResidentialRoom)
            {
                if (!Common.kDebugging) return false;

                return Common.AssemblyCheck.IsInstalled("NRaasGoHere");
            }
            else
            {
                return true;
            }
        }
Example #24
0
 public AnnouncementsOffAppend(ObjectGuid guid)
 {
     _guid = guid;
 }
Example #25
0
 public PlayerAlreadyMemberAppend(ObjectGuid guid)
 {
     _guid = guid;
 }
Example #26
0
 /// <summary>
 /// A new biota be created taking all of its values from weenie.
 /// </summary>
 public GamePiece(Weenie weenie, ObjectGuid guid) : base(weenie, guid)
 {
     SetEphemeralValues();
 }
Example #27
0
 public PlayerBannedAppend(ObjectGuid moderator, ObjectGuid banned)
 {
     _moderator = moderator;
     _banned    = banned;
 }
Example #28
0
 public void AttackEnqueue(Position dest, ObjectGuid victim)
 {
     GamePieceState = GamePieceState.MoveToAttack;
     Position       = dest;
     TargetPiece    = CurrentLandblock.GetObject(victim) as GamePiece;
 }
 public Definition(ObjectGuid mParentRug)
 {
     this.mParentRug = ObjectGuid.InvalidObjectGuid;
     this.mParentRug = mParentRug;
 }
Example #30
0
 protected override ServiceSituation InternalCreateSituation(Lot assignedLot, Sim createdSim, int cost, ObjectGuid requestingSim)
 {
     return new GiftGiverSituation(this, assignedLot, createdSim, cost);
 }
Example #31
0
 /// <summary>
 /// A new biota be created taking all of its values from weenie.
 /// </summary>
 public SpellProjectile(Weenie weenie, ObjectGuid guid) : base(weenie, guid)
 {
     SetEphemeralValues();
 }
Example #32
0
        public void OnUpdateIconNotification(SkewerNotificationType type, ObjectGuid simGuid, bool bShow)
        {
            try
            {
                for (int i = 0x0; i < mHouseholdItems.Length; i++)
                {
                    if ((mHouseholdItems[i].mSimInfo != null) && (mHouseholdItems[i].mSimInfo.mGuid == simGuid))
                    {
                        switch (type)
                        {
                            case SkewerNotificationType.GroupingNotfication:
                                mHouseholdItems[i].mGroupButton.Visible = bShow;
                                mHouseholdItems[i].mDateButton.Visible = false;
                                break;

                            case SkewerNotificationType.DatingNotification:
                                mHouseholdItems[i].mDateButton.Visible = bShow;
                                mHouseholdItems[i].mGroupButton.Visible = false;
                                break;

                            case SkewerNotificationType.FollowNotification:
                                mHouseholdItems[i].mbShouldShowFollowNotify = bShow;
                                mHouseholdItems[i].mFollowNotification.Visible = bShow;
                                break;

                            case SkewerNotificationType.EnsorcelNotification:
                                mHouseholdItems[i].mEnsorcelButton.Visible = bShow;
                                mHouseholdItems[i].mGroupButton.Visible = bShow;
                                break;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Common.Exception("OnUpdateIconNotification", exception);
            }
        }
Example #33
0
        public static StoreSetRegister ReturnRegister(ObjectGuid id, Lot lot)
        {
            StoreSetRegister register = null;
            List<StoreSetRegister> registers = new List<StoreSetRegister>(Sims3.Gameplay.Queries.GetObjects<StoreSetRegister>(lot));

            if (registers != null && registers.Count > 0)
            {
                register = registers.Find(delegate(StoreSetRegister r) { return r.ObjectId == id; });
            }

            return register;
        }
Example #34
0
        public bool SelectSim(ObjectGuid objectGuid)
        {
            Sim actor = GameObject.GetObject<IActor>(objectGuid) as Sim;
            if (actor == null) return false;

            return DreamCatcher.Select(actor, PortraitPanel.Settings.mDreamCatcher, true);
        }
Example #35
0
        void HandleAuctionPlaceBid(AuctionPlaceBid packet)
        {
            if (packet.AuctionItemID == 0 || packet.BidAmount == 0)
            {
                return; // check for cheaters
            }
            Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer);

            if (!creature)
            {
                Log.outDebug(LogFilter.Network, "WORLD: HandleAuctionPlaceBid - {0} not found or you can't interact with him.", packet.Auctioneer.ToString());
                return;
            }

            // remove fake death
            if (GetPlayer().HasUnitState(UnitState.Died))
            {
                GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
            }

            AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.getFaction());

            AuctionEntry auction = auctionHouse.GetAuction(packet.AuctionItemID);
            Player       player  = GetPlayer();

            if (auction == null || auction.owner == player.GetGUID().GetCounter())
            {
                //you cannot bid your own auction:
                SendAuctionCommandResult(null, AuctionAction.PlaceBid, AuctionError.BidOwn);
                return;
            }

            // impossible have online own another character (use this for speedup check in case online owner)
            ObjectGuid ownerGuid     = ObjectGuid.Create(HighGuid.Player, auction.owner);
            Player     auction_owner = Global.ObjAccessor.FindPlayer(ownerGuid);

            if (!auction_owner && ObjectManager.GetPlayerAccountIdByGUID(ownerGuid) == player.GetSession().GetAccountId())
            {
                //you cannot bid your another character auction:
                SendAuctionCommandResult(null, AuctionAction.PlaceBid, AuctionError.BidOwn);
                return;
            }

            // cheating
            if (packet.BidAmount <= auction.bid || packet.BidAmount < auction.startbid)
            {
                return;
            }

            // price too low for next bid if not buyout
            if ((packet.BidAmount < auction.buyout || auction.buyout == 0) && packet.BidAmount < auction.bid + auction.GetAuctionOutBid())
            {
                // client already test it but just in case ...
                SendAuctionCommandResult(auction, AuctionAction.PlaceBid, AuctionError.HigherBid);
                return;
            }

            if (!player.HasEnoughMoney(packet.BidAmount))
            {
                // client already test it but just in case ...
                SendAuctionCommandResult(auction, AuctionAction.PlaceBid, AuctionError.NotEnoughtMoney);
                return;
            }

            SQLTransaction trans = new SQLTransaction();

            if (packet.BidAmount < auction.buyout || auction.buyout == 0)
            {
                if (auction.bidder > 0)
                {
                    if (auction.bidder == player.GetGUID().GetCounter())
                    {
                        player.ModifyMoney(-(long)(packet.BidAmount - auction.bid));
                    }
                    else
                    {
                        // mail to last bidder and return money
                        Global.AuctionMgr.SendAuctionOutbiddedMail(auction, packet.BidAmount, GetPlayer(), trans);
                        player.ModifyMoney(-(long)packet.BidAmount);
                    }
                }
                else
                {
                    player.ModifyMoney(-(long)packet.BidAmount);
                }

                auction.bidder = player.GetGUID().GetCounter();
                auction.bid    = (uint)packet.BidAmount;
                GetPlayer().UpdateCriteria(CriteriaTypes.HighestAuctionBid, packet.BidAmount);

                PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_AUCTION_BID);
                stmt.AddValue(0, auction.bidder);
                stmt.AddValue(1, auction.bid);
                stmt.AddValue(2, auction.Id);
                trans.Append(stmt);

                SendAuctionCommandResult(auction, AuctionAction.PlaceBid, AuctionError.Ok);

                // Not sure if we must send this now.
                Player owner = Global.ObjAccessor.FindConnectedPlayer(ObjectGuid.Create(HighGuid.Player, auction.owner));
                Item   item  = Global.AuctionMgr.GetAItem(auction.itemGUIDLow);
                if (owner && item)
                {
                    owner.GetSession().SendAuctionOwnerBidNotification(auction, item);
                }
            }
            else
            {
                //buyout:
                if (player.GetGUID().GetCounter() == auction.bidder)
                {
                    player.ModifyMoney(-(long)(auction.buyout - auction.bid));
                }
                else
                {
                    player.ModifyMoney(-(long)auction.buyout);
                    if (auction.bidder != 0)                          //buyout for bidded auction ..
                    {
                        Global.AuctionMgr.SendAuctionOutbiddedMail(auction, auction.buyout, GetPlayer(), trans);
                    }
                }
                auction.bidder = player.GetGUID().GetCounter();
                auction.bid    = auction.buyout;
                GetPlayer().UpdateCriteria(CriteriaTypes.HighestAuctionBid, auction.buyout);

                SendAuctionCommandResult(auction, AuctionAction.PlaceBid, AuctionError.Ok);

                //- Mails must be under transaction control too to prevent data loss
                Global.AuctionMgr.SendAuctionSalePendingMail(auction, trans);
                Global.AuctionMgr.SendAuctionSuccessfulMail(auction, trans);
                Global.AuctionMgr.SendAuctionWonMail(auction, trans);

                auction.DeleteFromDB(trans);

                Global.AuctionMgr.RemoveAItem(auction.itemGUIDLow);
                auctionHouse.RemoveAuction(auction);
            }

            player.SaveInventoryAndGoldToDB(trans);
            DB.Characters.CommitTransaction(trans);
        }
Example #36
0
 public InviteAppend(ObjectGuid guid)
 {
     _guid = guid;
 }
Example #37
0
 public override void MakeServiceRequest(Lot lot, bool active, ObjectGuid simRequestingService)
 {
     base.MakeServiceRequest(lot, active, simRequestingService, true, 1);  //should be immediate I guess
 }
Example #38
0
 public void SetLandblockMessage(ObjectGuid target)
 {
     LandblockMessage = new GameMessageScript(target, Spell.TargetEffect, 1f);
 }
Example #39
0
 public void OnHouseholdChanged(Sims3.UI.Hud.HouseholdEvent ev, ObjectGuid objectGuid)
 {
     Common.FunctionTask.Perform(PopulateSkewers);
 }
Example #40
0
        public static RouteAction.ActionResult PerformAction(ObstacleEncounteredRouteInterruptAction ths)
        {
            try
            {
                ths.mRoutingSim.SimRoutingComponent.EnableDynamicFootprint();
                ths.mRoutingSim.SimRoutingComponent.StopPushImmunity();
                if ((ths.mRoutingSim.SimRoutingComponent.UsingStroller && (ths.mRoutingSim.CarryingChildPosture != null)) && (ths.mRoutingSim.CarryingChildPosture.Stroller != null))
                {
                    ths.mRoutingSim.CarryingChildPosture.Stroller.SetPosition(ths.mRoutingSim.CarryingChildPosture.Stroller.Position);
                }

                bool option = ths.mInterruptedPath.GetOption(Route.RouteOption.BlockedByPeople);
                ths.mInterruptedPath.SetOption(Route.RouteOption.BlockedByPeople, true);
                if (ths.mbForceInitialReplan)
                {
                    RoutePlanResult result = ths.mInterruptedPath.Replan();
                    if (!result.Succeeded())
                    {
                        GameObject obj2 = new ObjectGuid(result.mBlockerObjectId).ObjectFromId <GameObject>();
                        ths.mRoutingSim.SimRoutingComponent.PlayRouteFailureIfAppropriate(obj2);
                        return(RouteAction.ActionResult.Terminate);
                    }
                }

                /* This is duplicated in StandAndWaitController, I believe it is an EA error since there is no "Exit"
                 * StateMachineClient client = StateMachineClient.Acquire(ths.mRoutingSim, "StandAndWait");
                 * client.SetActor("x", ths.mRoutingSim);
                 * client.SetParameter("isMermaid", OccultMermaid.IsMatureMermaidAndWearingTail(base.mRoutingSim));
                 * client.EnterState("x", "Enter");
                 */

                SpeedTrap.Sleep();
                ths.mnCheckFrequency = 0x1;
                ths.mnCheckOffset    = 0x0;
                try
                {
                    StandAndWaitController controller = new StandAndWaitController();
                    controller.AllowZeroCycle = ths.mbAllowZeroCycle;
                    controller.Duration       = SimRoutingComponent.DefaultStandAndWaitDuration;
                    controller.OnCycle        = ths.StandAndWaitCycleHandler;
                    controller.Run(ths.mRoutingSim);
                }
                catch (SacsErrorException e)
                {
                    Common.DebugException("ObstacleEncounteredRouteInterruptActionEx:PerformAction", e);
                }

                ths.mRoutingSim.SimRoutingComponent.DisableDynamicFootprint();
                if (!ths.mbElectedToExit)
                {
                    ths.mReturnValue = RouteAction.ActionResult.Terminate;
                }

                if (ths.mReturnValue == RouteAction.ActionResult.Terminate)
                {
                    int          numObstacles            = 0x0;
                    int          numPushableObstacles    = 0x0;
                    int          numWorldObstacles       = 0x0;
                    int          numStaticObstacles      = 0x0;
                    int          numReplannableObstacles = 0x0;
                    ObjectGuid[] guidArray = ths.CollectObstacles(ths.mRoutingSim, ref numObstacles, ref numPushableObstacles, ref numReplannableObstacles, ref numStaticObstacles, ref numWorldObstacles);
                    int          num6      = numObstacles - numWorldObstacles;
                    if (numObstacles > 0x0)
                    {
                        if ((ths.mRoutingSim.LotCurrent != null) && !ths.mRoutingSim.LotCurrent.IsWorldLot)
                        {
                            if ((num6 == 0x0) && (numWorldObstacles > 0x0))
                            {
                                ths.mRoutingSim.SimRoutingComponent.StartIgnoringObstacles();
                                return(RouteAction.ActionResult.ContinueAndFollowPath);
                            }
                            else if ((num6 >= 0x3) && (Sims3.Gameplay.Queries.CountObjects <Sim>(ths.mRoutingSim.Position, 1f) >= 0x4))
                            {
                                ths.mRoutingSim.SimRoutingComponent.StartIgnoringObstacles();
                                return(RouteAction.ActionResult.ContinueAndFollowPath);
                            }
                        }
                        else if (numWorldObstacles > 0x0)
                        {
                            ths.mRoutingSim.SimRoutingComponent.StartIgnoringObstacles();
                            return(RouteAction.ActionResult.ContinueAndFollowPath);
                        }
                    }
                    else
                    {
                        ths.mRoutingSim.SimRoutingComponent.StartPushImmunity(SimRoutingComponent.OnRouteStartedImmuneToPushesDuration);
                    }

                    if ((!ths.mRoutingSim.HasExitReason(ExitReason.CancelExternal | ExitReason.MidRoutePushRequested) && ths.mInterruptedPath.DoRouteFail) && !ths.mInterruptedPath.PlanResult.Succeeded())
                    {
                        foreach (ObjectGuid guid in guidArray)
                        {
                            GameObject obj3 = guid.ObjectFromId <GameObject>();
                            if (ths.mRoutingSim.SimRoutingComponent.PlayRouteFailureIfAppropriate(obj3))
                            {
                                break;
                            }
                        }
                    }
                }

                ths.mInterruptedPath.SetOption(Route.RouteOption.BlockedByPeople, option);
                return(ths.mReturnValue);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception("ObstacleEncounteredRouteInterruptActionEx:PerformAction", e);
                throw;
            }
        }
Example #41
0
        public void AttachCameraToSim(ObjectGuid objectGuid)
        {
            Sim actor = GameObject.GetObject<Sim>(objectGuid);
            if (actor != null)
            {
                Camera.FocusOnSim(actor);

                CameraController.EnableObjectFollow(actor.ObjectId.Value, Vector3.Empty);
            }
        }
Example #42
0
 public void AddLooter(ObjectGuid guid)
 {
     PlayersLooting.Add(guid);
 }
Example #43
0
 public void OnSimNameChanged(ObjectGuid objGuid)
 {
     try
     {
         Skewer.SkewerItem item = new Skewer.SkewerItem();
         bool flag = false;
         foreach (Skewer.SkewerItem item2 in mHouseholdItems)
         {
             if ((item2.mSimInfo != null) && (item2.mSimInfo.mGuid == objGuid))
             {
                 flag = true;
                 item = item2;
                 break;
             }
         }
         if (flag)
         {
             UpdateButton(ref item, item.mSimInfo, false, true);
         }
     }
     catch (Exception exception)
     {
         Common.Exception("OnSimNameChanged", exception);
     }
 }
Example #44
0
 public void RemoveLooter(ObjectGuid guid)
 {
     PlayersLooting.Remove(guid);
 }
Example #45
0
        public void OnSimChanged(ObjectGuid objectGuid)
        {
            try
            {
                bool flag = false;
                foreach (Skewer.SkewerItem item in mHouseholdItems)
                {
                    if ((item.mSimInfo != null) && (item.mSimInfo.mGuid == objectGuid))
                    {
                        item.mButton.Selected = true;
                        if (item.mGoButton != null)
                        {
                            item.mGoButton.Visible = ShouldShowGoHomeButtonForSim(item.mSimInfo.mGuid);
                        }

                        Skewer.Instance.UpdateMoodWindow(item.mMood, item.mSimInfo);
                        item.mFollowNotification.Visible = item.mbShouldShowFollowNotify;
                        flag = true;
                    }
                    else
                    {
                        item.mButton.Selected = false;

                        if (item.mGoButton != null)
                        {
                            item.mGoButton.Visible = false;
                        }

                        item.mButton.Highlighted = false;
                        item.mFollowNotification.Visible = item.mbShouldShowFollowNotify;
                    }
                }

                if (!flag)
                {
                    Common.FunctionTask.Perform(PopulateSkewers);
                }
            }
            catch (Exception exception)
            {
                Common.Exception("OnSimChanged", exception);
            }
        }
Example #46
0
 public Definition(ObjectGuid target, bool usePath) : base(target, DisplayHelper.ComputeFinalPriceOnObject(target), usePath)
 {
     //this.mPath = new string[] { CraftersConsignment.LocalizeString(false, "PurchasePath", new object[0]) + Localization.Ellipsis };
     //this.mObject = target;
     //this.mCost = cost;
     //this.mUsePath = usePath;
 }
Example #47
0
 public DoorPortalComponentEx.DoorSettings GetDoorSettings(ObjectGuid door)
 {
     return GetDoorSettings(door, true);
 }
Example #48
0
        public void AddOrUpdateDoorSettings(ObjectGuid door, DoorPortalComponentEx.DoorSettings settings, bool doSimValidation)
        {
            if (mDoorSettings.ContainsKey(door))
            {
                mDoorSettings[door] = settings;
            }
            else
            {
                mDoorSettings.Add(door, settings);
            }

            if (doSimValidation)
            {
                Door door2 = GameObject.GetObject(door) as Door;

                if (door2 != null && door2.LotCurrent != null)
                {
                    foreach (Sim sim in door2.LotCurrent.mSims)
                    {
                        if (sim != null && sim.SimDescription != null && sim.RoomId == door2.GetAdjoiningRoom(door2.RoomId) && !LotManager.RoomIdIsOutside(sim.RoomId))
                        {
                            if (!settings.IsSimAllowedThrough(sim.SimDescription.SimDescriptionId))
                            {
                                StyledNotification.Format format = new StyledNotification.Format(Common.Localize("DoorFilter:WarningTrappedSims"), door2.ObjectId, ObjectGuid.InvalidObjectGuid, StyledNotification.NotificationStyle.kSystemMessage);
                                format.mTNSCategory = NotificationManager.TNSCategory.Lessons;
                                StyledNotification.Show(format);
                            }
                        }
                    }

                    foreach (Sim sim in LotManager.Actors)
                    {
                        if (sim == null || sim.mAllowedRooms == null) continue;

                        sim.mAllowedRooms.Remove(door2.LotCurrent.LotId);
                    }
                }
            }
        }
Example #49
0
 public void SetGUID(ObjectGuid guid)
 {
     _GUID = guid;
 }
Example #50
0
 public PlayerKickedAppend(ObjectGuid kicker, ObjectGuid kickee)
 {
     _kicker = kicker;
     _kickee = kickee;
 }
Example #51
0
 public Definition(ObjectGuid target, int cost, bool usePath)
 {
     this.mPath = new string[] { CraftersConsignment.LocalizeString(false, "PurchasePath", new object[0]) + Localization.Ellipsis };
     this.mObject = target;
     this.mCost = cost;
     this.mUsePath = usePath;
 }
Example #52
0
 /// <summary>
 /// Emits a sound at location sourceId and volume
 /// The client will perform sound attenuation / volume adjustment
 /// based on the listener distance from the origin of sourceId
 /// </summary>
 public void PlaySound(Sound sound, ObjectGuid sourceId, float volume = 1.0f)
 {
     Session.Network.EnqueueSend(new GameMessageSound(sourceId, sound, volume));
 }
Example #53
0
        public DoorPortalComponentEx.DoorSettings GetDoorSettings(ObjectGuid door, bool create)
        {
            DoorPortalComponentEx.DoorSettings settings;
            if (mDoorSettings.TryGetValue(door, out settings))
            {
                List<string> remove = new List<string>();
                foreach (string filter in settings.ActiveFilters)
                {
                    if (!FilterHelper.IsValidFilter(filter))
                    {
                        remove.Add(filter);
                    }
                }

                bool changed = false;
                foreach (string invalid in remove)
                {
                    Common.DebugNotify("Removed invalid door filter: " + invalid);
                    changed = true;
                    settings.RemoveFilter(invalid);
                }

                if (changed)
                {
                    AddOrUpdateDoorSettings(door, settings, false);
                }

                return settings;
            }

            if (create)
            {
                return new DoorPortalComponentEx.DoorSettings(door);
            }
            else
            {
                return null;
            }
        }
Example #54
0
        public void SendGossipMenu(uint titleTextId, ObjectGuid objectGUID)
        {
            _interactionData.Reset();
            _interactionData.SourceGuid = objectGUID;

            GossipMessagePkt packet = new GossipMessagePkt();

            packet.GossipGUID = objectGUID;
            packet.GossipID   = (int)_gossipMenu.GetMenuId();
            packet.TextID     = (int)titleTextId;

            uint count = 0;

            foreach (var pair in _gossipMenu.GetMenuItems())
            {
                ClientGossipOptions opt  = new ClientGossipOptions();
                GossipMenuItem      item = pair.Value;
                opt.ClientOption = (int)pair.Key;
                opt.OptionNPC    = item.MenuItemIcon;
                opt.OptionFlags  = (byte)(item.IsCoded ? 1 : 0); // makes pop up box password
                opt.OptionCost   = (int)item.BoxMoney;           // money required to open menu, 2.0.3
                opt.Text         = item.Message;                 // text for gossip item
                opt.Confirm      = item.BoxMessage;              // accept text (related to money) pop up box, 2.0.3
                packet.GossipOptions.Add(opt);

                ++count;
            }

            count = 0;
            for (byte i = 0; i < _questMenu.GetMenuItemCount(); ++i)
            {
                QuestMenuItem item    = _questMenu.GetItem(i);
                uint          questID = item.QuestId;
                Quest         quest   = Global.ObjectMgr.GetQuestTemplate(questID);
                if (quest != null)
                {
                    ClientGossipText text = new ClientGossipText();
                    text.QuestID      = (int)questID;
                    text.QuestType    = item.QuestIcon;
                    text.QuestLevel   = quest.Level;
                    text.QuestFlags   = (int)quest.Flags;
                    text.QuestFlagsEx = (int)quest.FlagsEx;
                    text.Repeatable   = quest.IsRepeatable();

                    text.QuestTitle = quest.LogTitle;
                    LocaleConstant locale = _session.GetSessionDbLocaleIndex();
                    if (locale != LocaleConstant.enUS)
                    {
                        QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id);
                        if (localeData != null)
                        {
                            ObjectManager.GetLocaleString(localeData.LogTitle, locale, ref text.QuestTitle);
                        }
                    }

                    packet.GossipText.Add(text);
                    ++count;
                }
            }

            _session.SendPacket(packet);
        }
Example #55
0
        public void ClearActiveDoorFilters(ObjectGuid guid)
        {
            DoorPortalComponentEx.DoorSettings settings = GetDoorSettings(guid);

            if (settings != null)
            {
                settings.ClearFilters();
                AddOrUpdateDoorSettings(guid, settings, false);
            }
        }
Example #56
0
        public void SendQuestGiverQuestDetails(Quest quest, ObjectGuid npcGUID, bool activateAccept)
        {
            QuestGiverQuestDetails packet = new QuestGiverQuestDetails();

            packet.QuestTitle         = quest.LogTitle;
            packet.LogDescription     = quest.LogDescription;
            packet.DescriptionText    = quest.QuestDescription;
            packet.PortraitGiverText  = quest.PortraitGiverText;
            packet.PortraitGiverName  = quest.PortraitGiverName;
            packet.PortraitTurnInText = quest.PortraitTurnInText;
            packet.PortraitTurnInName = quest.PortraitTurnInName;

            LocaleConstant locale = _session.GetSessionDbLocaleIndex();

            if (locale != LocaleConstant.enUS)
            {
                QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id);
                if (localeData != null)
                {
                    ObjectManager.GetLocaleString(localeData.LogTitle, locale, ref packet.QuestTitle);
                    ObjectManager.GetLocaleString(localeData.LogDescription, locale, ref packet.LogDescription);
                    ObjectManager.GetLocaleString(localeData.QuestDescription, locale, ref packet.DescriptionText);
                    ObjectManager.GetLocaleString(localeData.PortraitGiverText, locale, ref packet.PortraitGiverText);
                    ObjectManager.GetLocaleString(localeData.PortraitGiverName, locale, ref packet.PortraitGiverName);
                    ObjectManager.GetLocaleString(localeData.PortraitTurnInText, locale, ref packet.PortraitTurnInText);
                    ObjectManager.GetLocaleString(localeData.PortraitTurnInName, locale, ref packet.PortraitTurnInName);
                }
            }

            packet.QuestGiverGUID        = npcGUID;
            packet.InformUnit            = _session.GetPlayer().GetDivider();
            packet.QuestID               = quest.Id;
            packet.PortraitGiver         = quest.QuestGiverPortrait;
            packet.PortraitTurnIn        = quest.QuestTurnInPortrait;
            packet.AutoLaunched          = activateAccept;
            packet.QuestFlags[0]         = (uint)quest.Flags;
            packet.QuestFlags[1]         = (uint)quest.FlagsEx;
            packet.SuggestedPartyMembers = quest.SuggestedPlayers;

            if (quest.SourceSpellID != 0)
            {
                packet.LearnSpells.Add(quest.SourceSpellID);
            }

            quest.BuildQuestRewards(packet.Rewards, _session.GetPlayer());

            for (int i = 0; i < SharedConst.QuestEmoteCount; ++i)
            {
                var emote = new QuestDescEmote(quest.DetailsEmote[i], quest.DetailsEmoteDelay[i]);
                packet.DescEmotes.Add(emote);
            }

            var objs = quest.Objectives;

            for (int i = 0; i < objs.Count; ++i)
            {
                var obj = new QuestObjectiveSimple();
                obj.ID       = objs[i].ID;
                obj.ObjectID = objs[i].ObjectID;
                obj.Amount   = objs[i].Amount;
                obj.Type     = (byte)objs[i].Type;
                packet.Objectives.Add(obj);
            }

            _session.SendPacket(packet);
        }
 public Definition()
 {
     this.mParentRug = ObjectGuid.InvalidObjectGuid;
 }
Example #58
0
        public void SendQuestGiverOfferReward(Quest quest, ObjectGuid npcGUID, bool enableNext)
        {
            QuestGiverOfferRewardMessage packet = new QuestGiverOfferRewardMessage();

            packet.QuestTitle         = quest.LogTitle;
            packet.RewardText         = quest.OfferRewardText;
            packet.PortraitGiverText  = quest.PortraitGiverText;
            packet.PortraitGiverName  = quest.PortraitGiverName;
            packet.PortraitTurnInText = quest.PortraitTurnInText;
            packet.PortraitTurnInName = quest.PortraitTurnInName;

            LocaleConstant locale = _session.GetSessionDbLocaleIndex();

            if (locale != LocaleConstant.enUS)
            {
                QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id);
                if (localeData != null)
                {
                    ObjectManager.GetLocaleString(localeData.LogTitle, locale, ref packet.QuestTitle);
                    ObjectManager.GetLocaleString(localeData.PortraitGiverText, locale, ref packet.PortraitGiverText);
                    ObjectManager.GetLocaleString(localeData.PortraitGiverName, locale, ref packet.PortraitGiverName);
                    ObjectManager.GetLocaleString(localeData.PortraitTurnInText, locale, ref packet.PortraitTurnInText);
                    ObjectManager.GetLocaleString(localeData.PortraitTurnInName, locale, ref packet.PortraitTurnInName);
                }

                QuestOfferRewardLocale questOfferRewardLocale = Global.ObjectMgr.GetQuestOfferRewardLocale(quest.Id);
                if (questOfferRewardLocale != null)
                {
                    ObjectManager.GetLocaleString(questOfferRewardLocale.RewardText, locale, ref packet.RewardText);
                }
            }

            QuestGiverOfferReward offer = new QuestGiverOfferReward();

            quest.BuildQuestRewards(offer.Rewards, _session.GetPlayer());
            offer.QuestGiverGUID = npcGUID;

            // Is there a better way? what about game objects?
            Creature creature = ObjectAccessor.GetCreature(_session.GetPlayer(), npcGUID);

            if (creature)
            {
                offer.QuestGiverCreatureID = creature.GetCreatureTemplate().Entry;
            }

            offer.QuestID               = quest.Id;
            offer.AutoLaunched          = enableNext;
            offer.SuggestedPartyMembers = quest.SuggestedPlayers;

            for (uint i = 0; i < SharedConst.QuestEmoteCount && quest.OfferRewardEmote[i] != 0; ++i)
            {
                offer.Emotes.Add(new QuestDescEmote(quest.OfferRewardEmote[i], quest.OfferRewardEmoteDelay[i]));
            }

            offer.QuestFlags[0] = (uint)quest.Flags;
            offer.QuestFlags[1] = (uint)quest.FlagsEx;

            packet.PortraitTurnIn = quest.QuestTurnInPortrait;
            packet.PortraitGiver  = quest.QuestGiverPortrait;
            packet.QuestPackageID = quest.PackageID;

            packet.QuestData = offer;

            _session.SendPacket(packet);
        }
Example #59
0
        public override void RunEvent(Career c)
        {
            Career newCareer = NewCareer as Career;
            if (newCareer == null) return;

            int newCareerLevel = this.GetNewCareerLevel(c);
            CareerLevel level = null;
            foreach (Dictionary<int, CareerLevel> dictionary in newCareer.CareerLevels.Values)
            {
                if (dictionary.TryGetValue(newCareerLevel, out level))
                {
                    ObjectGuid simObjectId = new ObjectGuid();
                    if (c.OwnerDescription.CreatedSim != null)
                    {
                        simObjectId = c.OwnerDescription.CreatedSim.ObjectId;
                    }
                    if (Display(LocalizeString(c.OwnerDescription.IsFemale, mStringKey, new object[] { c.OwnerDescription, level.GetLocalizedName(c.OwnerDescription), level.Level, c.CurLevel.GetLocalizedName(c.OwnerDescription), c.CareerLevel }), simObjectId, c.OwnerDescription.IsFemale, c))
                    {
                        DoTransfer(c, newCareerLevel);
                    }
                    break;
                }
            }
        }
Example #60
0
        public void SendQuestGiverRequestItems(Quest quest, ObjectGuid npcGUID, bool canComplete, bool closeOnCancel)
        {
            // We can always call to RequestItems, but this packet only goes out if there are actually
            // items.  Otherwise, we'll skip straight to the OfferReward

            if (!quest.HasSpecialFlag(QuestSpecialFlags.Deliver) && canComplete)
            {
                SendQuestGiverOfferReward(quest, npcGUID, true);
                return;
            }

            QuestGiverRequestItems packet = new QuestGiverRequestItems();

            packet.QuestTitle     = quest.LogTitle;
            packet.CompletionText = quest.RequestItemsText;

            LocaleConstant locale = _session.GetSessionDbLocaleIndex();

            if (locale != LocaleConstant.enUS)
            {
                QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id);
                if (localeData != null)
                {
                    ObjectManager.GetLocaleString(localeData.LogTitle, locale, ref packet.QuestTitle);
                }

                QuestRequestItemsLocale questRequestItemsLocale = Global.ObjectMgr.GetQuestRequestItemsLocale(quest.Id);
                if (questRequestItemsLocale != null)
                {
                    ObjectManager.GetLocaleString(questRequestItemsLocale.CompletionText, locale, ref packet.CompletionText);
                }
            }

            packet.QuestGiverGUID = npcGUID;

            // Is there a better way? what about game objects?
            Creature creature = ObjectAccessor.GetCreature(_session.GetPlayer(), npcGUID);

            if (creature)
            {
                packet.QuestGiverCreatureID = creature.GetCreatureTemplate().Entry;
            }

            packet.QuestID = quest.Id;

            if (canComplete)
            {
                packet.CompEmoteDelay = quest.EmoteOnCompleteDelay;
                packet.CompEmoteType  = quest.EmoteOnComplete;
            }
            else
            {
                packet.CompEmoteDelay = quest.EmoteOnIncompleteDelay;
                packet.CompEmoteType  = quest.EmoteOnIncomplete;
            }

            packet.QuestFlags[0]       = (uint)quest.Flags;
            packet.QuestFlags[1]       = (uint)quest.FlagsEx;
            packet.SuggestPartyMembers = quest.SuggestedPlayers;

            // incomplete: FD
            // incomplete quest with item objective but item objective is complete DD
            packet.StatusFlags = canComplete ? 0xFF : 0xFD;

            packet.MoneyToGet = 0;
            foreach (QuestObjective obj in quest.Objectives)
            {
                switch (obj.Type)
                {
                case QuestObjectiveType.Item:
                    packet.Collect.Add(new QuestObjectiveCollect((uint)obj.ObjectID, obj.Amount, (uint)obj.Flags));
                    break;

                case QuestObjectiveType.Currency:
                    packet.Currency.Add(new QuestCurrency((uint)obj.ObjectID, obj.Amount));
                    break;

                case QuestObjectiveType.Money:
                    packet.MoneyToGet += obj.Amount;
                    break;

                default:
                    break;
                }
            }

            packet.AutoLaunched = closeOnCancel;

            _session.SendPacket(packet);
        }