System.Collections.Generic.Dictionary.ContainsKey(uint)

Here are the examples of the csharp api System.Collections.Generic.Dictionary.ContainsKey(uint) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

692 Examples 7

19 Source : RtmpSession.cs
with MIT License
from a1q123456

internal void replacedertStreamId(uint msid)
        {
            Debug.replacedert(_messageStreams.ContainsKey(msid));
        }

19 Source : ManipulationHandler.cs
with Apache License 2.0
from abist-co-ltd

public Vector3 GetPointerGrabPoint(uint pointerId)
        {
            replacedert.IsTrue(pointerIdToPointerMap.ContainsKey(pointerId));
            return pointerIdToPointerMap[pointerId].GrabPoint;
        }

19 Source : ManipulationHandler.cs
with Apache License 2.0
from abist-co-ltd

public void OnPointerDown(MixedRealityPointerEventData eventData)
        {
            if (eventData.used ||
                (!allowFarManipulation && eventData.Pointer as IMixedRealityNearPointer == null))
            {
                return;
            }

            // If we only allow one handed manipulations, check there is no hand interacting yet. 
            if (manipulationType != HandMovementType.OneHandedOnly || pointerIdToPointerMap.Count == 0)
            {
                uint id = eventData.Pointer.PointerId;
                // Ignore poke pointer events
                if (!pointerIdToPointerMap.ContainsKey(eventData.Pointer.PointerId))
                {
                    if (pointerIdToPointerMap.Count == 0)
                    {
                        rigidBody = GetComponent<Rigidbody>();
                        if (rigidBody != null)
                        {
                            wasKinematic = rigidBody.isKinematic;
                            rigidBody.isKinematic = true;
                        }
                    }

                    // cache start ptr grab point
                    Vector3 initialGrabPoint = Quaternion.Inverse(eventData.Pointer.Rotation) * (eventData.Pointer.Result.Details.Point - eventData.Pointer.Position);
                    pointerIdToPointerMap.Add(id, new PointerData(eventData.Pointer, initialGrabPoint));

                    UpdateStateMachine();
                }
            }

            if (pointerIdToPointerMap.Count > 0)
            {
                // Always mark the pointer data as used to prevent any other behavior to handle pointer events
                // as long as the ManipulationHandler is active.
                // This is due to us reacting to both "Select" and "Grip" events.
                eventData.Use();
            }
        }

19 Source : ManipulationHandler.cs
with Apache License 2.0
from abist-co-ltd

public void OnPointerUp(MixedRealityPointerEventData eventData)
        {
            uint id = eventData.Pointer.PointerId;
            if (pointerIdToPointerMap.ContainsKey(id))
            {
                if (pointerIdToPointerMap.Count == 1 && rigidBody != null)
                {
                    ReleaseRigidBody();
                }

                pointerIdToPointerMap.Remove(id);
            }

            UpdateStateMachine();
            eventData.Use();
        }

19 Source : ObjectManipulator.cs
with Apache License 2.0
from abist-co-ltd

public void OnPointerDown(MixedRealityPointerEventData eventData)
        {
            if (eventData.used || 
                (!allowFarManipulation && eventData.Pointer as IMixedRealityNearPointer == null))
            {
                return;
            }

            // If we only allow one handed manipulations, check there is no hand interacting yet. 
            if (manipulationType != ManipulationHandFlags.OneHanded || pointerIdToPointerMap.Count == 0)
            {
                uint id = eventData.Pointer.PointerId;
                // Ignore poke pointer events
                if (!pointerIdToPointerMap.ContainsKey(id))
                {
                    // cache start ptr grab point
                    pointerIdToPointerMap.Add(id, new PointerData(eventData.Pointer, eventData.Pointer.Result.Details.Point));

                    // Call manipulation started handlers
                    if (IsTwoHandedManipulationEnabled)
                    {
                        if (!isManipulationStarted)
                        {
                            HandleManipulationStarted();
                        }
                        HandleTwoHandManipulationStarted();
                    }
                    else if (IsOneHandedManipulationEnabled)
                    {
                        if (!isManipulationStarted)
                        {
                            HandleManipulationStarted();
                        }
                        HandleOneHandMoveStarted();
                    }
                }
            }

            if (pointerIdToPointerMap.Count > 0)
            {
                // Always mark the pointer data as used to prevent any other behavior to handle pointer events
                // as long as the ObjectManipulator is active.
                // This is due to us reacting to both "Select" and "Grip" events.
                eventData.Use();
            }
        }

19 Source : ObjectManipulator.cs
with Apache License 2.0
from abist-co-ltd

public void OnPointerUp(MixedRealityPointerEventData eventData)
        {
            // Get pointer data before they are removed from the map
            Vector3 grabPoint = GetPointersGrabPoint();
            Vector3 velocity = GetPointersVelocity();
            Vector3 angularVelocity = GetPointersAngularVelocity();

            uint id = eventData.Pointer.PointerId;
            if (pointerIdToPointerMap.ContainsKey(id))
            {
                pointerIdToPointerMap.Remove(id);
            }

            // Call manipulation ended handlers
            var handsPressedCount = pointerIdToPointerMap.Count;
            if (manipulationType.HasFlag(ManipulationHandFlags.TwoHanded) && handsPressedCount == 1)
            {
                if (manipulationType.HasFlag(ManipulationHandFlags.OneHanded))
                {
                    HandleOneHandMoveStarted();
                }
                else
                {
                    HandleManipulationEnded(grabPoint, velocity, angularVelocity);
                }
            }
            else if (isManipulationStarted && handsPressedCount == 0)
            {
                HandleManipulationEnded(grabPoint, velocity, angularVelocity);
            }

            eventData.Use();
        }

19 Source : GazeHandHelper.cs
with Apache License 2.0
from abist-co-ltd

private bool IsInDictionary(uint id)
        {
            return handSourceMap.ContainsKey(id);
        }

19 Source : HandInteractionPanZoom.cs
with Apache License 2.0
from abist-co-ltd

private bool UpdateHandTouchingPoint(uint sourceId)
        {
            Vector3 tryHandPoint = Vector3.zero;
            bool tryGetSucceeded = false;
            if (handDataMap.ContainsKey(sourceId) == true)
            {
                HandPanData data = handDataMap[sourceId];

                if (data.IsActive == true)
                {
                    if (data.IsSourceNear == true)
                    {
                        tryGetSucceeded = TryGetHandPositionFromController(data.currentController, TrackedHandJoint.IndexTip, out tryHandPoint);
                    }
                    else
                    {
                        tryGetSucceeded = TryGetHandPositionFromController(data.currentController, TrackedHandJoint.Palm, out tryHandPoint);
                    }
                    if (!tryGetSucceeded)
                    {
                        tryGetSucceeded = TryGetMRControllerRayPoint(data, out tryHandPoint);
                    }

                    if (tryGetSucceeded == true)
                    {
                        tryHandPoint = SnapFingerToQuad(tryHandPoint);
                        Vector3 unfilteredTouchPt = (data.IsSourceNear == true) ? tryHandPoint : tryHandPoint + data.touchingRayOffset;
                        runningAverageSmoothing = panZoomSmoothing * percentToDecimal;
                        unfilteredTouchPt *= (1.0f - runningAverageSmoothing);
                        data.touchingPointSmoothed = (data.touchingPointSmoothed * runningAverageSmoothing) + unfilteredTouchPt;
                        data.touchingPoint = data.touchingPointSmoothed;
                    }
                }
            }

            return true;
        }

19 Source : HandInteractionPanZoom.cs
with Apache License 2.0
from abist-co-ltd

private void EndTouch(uint sourceId)
        {
            if (handDataMap.ContainsKey(sourceId) == true)
            {
                handDataMap.Remove(sourceId);
                RaisePanEnded(0);
            }
        }

19 Source : SurfaceMeshSelectionModifier.cs
with MIT License
from ABTSoftware

public override void OnModifierMouseUp(ModifierMouseArgs e)
        {
            base.OnModifierMouseUp(e);

            ClearAll();

            if (!IsDragging || Viewport3D == null || Viewport3D.RootEnreplacedy == null) return;

            var endPoint = e.MousePoint;
            var distanceDragged = PointUtil.Distance(StartPoint, endPoint);
            var isAreaSelection = distanceDragged > MinDragSensitivity;

            IList<EnreplacedyVertexId> hitEnreplacedyVertexIds;
            if (isAreaSelection)
            {
                // Drag select
                hitEnreplacedyVertexIds = Viewport3D.PickScene(new Rect(StartPoint, e.MousePoint));
            }
            else
            {
                // Point select
                var vertexId = Viewport3D.PickScene(e.MousePoint);
                hitEnreplacedyVertexIds = vertexId.HasValue ? new[] { vertexId.Value } : new EnreplacedyVertexId[0];
            }
            if (!hitEnreplacedyVertexIds.IsNullOrEmpty())
            {
                var hitEnreplacedyGroups = hitEnreplacedyVertexIds
                    .GroupBy(x => x.EnreplacedyId)
                    .ToDictionary(x => x.Key, x => x.Select(i => new VertexId { Id = i.VertexId }).ToList());

                var xSize = BoundedPaletteProvider.XSize - 1;

                //Visit enreplacedies to perform selection or deselection
                Viewport3D.RootEnreplacedy.VisitEnreplacedies(enreplacedy =>
                {
                    var enreplacedyId = enreplacedy.EnreplacedyId;
                    var hitVertexIds = new List<VertexId>();

                    if (hitEnreplacedyGroups.ContainsKey(enreplacedyId))
                    {
                        hitVertexIds = hitEnreplacedyGroups[enreplacedyId];
                    }

                    if (hitVertexIds.Any())
                    {
                        if (!_selectedVertices.ContainsKey(enreplacedyId))
                            _selectedVertices.Add(enreplacedyId, new HashSet<ulong>());


                        var selectedVertices = _selectedVertices[enreplacedyId];
                        hitVertexIds.ForEach(x => selectedVertices.Add(x.Id));

                        BoundedPaletteProvider.SelectedIndexes.Clear();
                        foreach (var hitEnreplacedyVertexId in hitEnreplacedyVertexIds)
                        {
                            var id = Convert.ToInt32(hitEnreplacedyVertexId.VertexId) - 1;
                            var vertexIndexInfo = new SurfaceMeshVertexInfo();
                            if (id < xSize)
                            {
                                vertexIndexInfo.XIndex = id;
                            }
                            else
                            {
                                vertexIndexInfo.ZIndex = id / xSize;
                                vertexIndexInfo.XIndex = id - (vertexIndexInfo.ZIndex * xSize);
                            }

                            BoundedPaletteProvider.SelectedIndexes.Add(vertexIndexInfo);
                        }
                    }
                    else
                    {
                        _selectedVertices.Remove(enreplacedyId);
                        BoundedPaletteProvider.SelectedIndexes.Clear();
                    }
                });
            }

            IsDragging = false;
            ReleaseMouseCapture();
            BoundedPaletteProvider.DataSeries.IsDirty = true;
            BoundedPaletteProvider.DataSeries.OnDataSeriesChanged(DataSeriesUpdate.SelectionChanged,
                DataSeriesAction.None);
        }

19 Source : GDLELoader.cs
with GNU Affero General Public License v3.0
from ACEmulator

private static void ReGuidAndConvertLandblocks(out List<LandblockInstance> results, out List<LandblockInstanceLink> links, ushort startingIdOffset, List<Models.Landblock> landblocks)
        {
            var idChanges = new Dictionary<uint /*LBID*/, Dictionary<uint /*from*/, uint /*to*/>>();

            // First we convert all weenies
            foreach (var landblock in landblocks)
            {
                var currentOffset = startingIdOffset;

                if (!idChanges.ContainsKey(landblock.key))
                    idChanges.Add(landblock.key, new Dictionary<uint, uint>());

                foreach (var weenie in landblock.value.weenies)
                {
                    var newGuid = (0x70000000 | ((weenie.pos.objcell_id & 0xFFFF0000) >> 4) | currentOffset);
                    currentOffset++;

                    if (!idChanges[landblock.key].ContainsKey(weenie.id))
                    {
                        idChanges[landblock.key].Add(weenie.id, newGuid);
                        weenie.id = newGuid;
                    }
                }
            }

            // Then we update all the links
            foreach (var landblock in landblocks)
            {
                if (landblock.value.links == null)
                    continue;

                foreach (var link in landblock.value.links)
                {
                    if (idChanges[landblock.key].TryGetValue(link.source, out var source))
                        link.source = source;
                    else
                        link.source = 0;

                    if (idChanges[landblock.key].TryGetValue(link.target, out var target))
                        link.target = target;
                    else
                        link.target = 0;
                }
            }

            TryConvertLandblocks(out results, out links, landblocks);
        }

19 Source : WorldDatabase.cs
with GNU Affero General Public License v3.0
from ACEmulator

public Dictionary<uint, List<TreasureWielded>> GetAllTreasureWielded(WorldDbContext context)
        {
            var results = context.TreasureWielded;

            var treasure = new Dictionary<uint, List<TreasureWielded>>();

            foreach (var record in results)
            {
                if (!treasure.ContainsKey(record.TreasureType))
                    treasure.Add(record.TreasureType, new List<TreasureWielded>());

                treasure[record.TreasureType].Add(record);
            }

            return treasure;

        }

19 Source : WorldDatabaseWithEntityCache.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override CookBook GetCookbook(WorldDbContext context, uint sourceWeenieClreplacedId, uint targetWeenieClreplacedId)
        {
            var cookbook = base.GetCookbook(context, sourceWeenieClreplacedId, targetWeenieClreplacedId);

            lock (cookbookCache)
            {
                // We double check before commiting the recipe.
                // We could be in this lock, and queued up behind us is an attempt to add a result for the same source:target pair.
                if (cookbookCache.TryGetValue(sourceWeenieClreplacedId, out var sourceRecipes))
                {
                    if (!sourceRecipes.ContainsKey(targetWeenieClreplacedId))
                        sourceRecipes.Add(targetWeenieClreplacedId, cookbook);
                }
                else
                    cookbookCache.Add(sourceWeenieClreplacedId, new Dictionary<uint, CookBook>() { { targetWeenieClreplacedId, cookbook } });
            }

            if (cookbook != null)
            {
                // build secondary index for RecipeManager_New caching
                lock (recipeCache)
                {
                    if (!recipeCache.ContainsKey(cookbook.RecipeId))
                        recipeCache.Add(cookbook.RecipeId, cookbook.Recipe);
                }
            }
            return cookbook;
        }

19 Source : WorldDatabaseWithEntityCache.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override CookBook GetCookbook(WorldDbContext context, uint sourceWeenieClreplacedId, uint targetWeenieClreplacedId)
        {
            var cookbook = base.GetCookbook(context, sourceWeenieClreplacedId, targetWeenieClreplacedId);

            lock (cookbookCache)
            {
                // We double check before commiting the recipe.
                // We could be in this lock, and queued up behind us is an attempt to add a result for the same source:target pair.
                if (cookbookCache.TryGetValue(sourceWeenieClreplacedId, out var sourceRecipes))
                {
                    if (!sourceRecipes.ContainsKey(targetWeenieClreplacedId))
                        sourceRecipes.Add(targetWeenieClreplacedId, cookbook);
                }
                else
                    cookbookCache.Add(sourceWeenieClreplacedId, new Dictionary<uint, CookBook>() { { targetWeenieClreplacedId, cookbook } });
            }

            if (cookbook != null)
            {
                // build secondary index for RecipeManager_New caching
                lock (recipeCache)
                {
                    if (!recipeCache.ContainsKey(cookbook.RecipeId))
                        recipeCache.Add(cookbook.RecipeId, cookbook.Recipe);
                }
            }
            return cookbook;
        }

19 Source : WorldDatabaseWithEntityCache.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override List<CookBook> GetAllCookbooks()
        {
            var cookbooks = base.GetAllCookbooks();

            // Add the cookbooks to the cache
            lock (cookbookCache)
            {
                foreach (var cookbook in cookbooks)
                {
                    // We double check before commiting the recipe.
                    // We could be in this lock, and queued up behind us is an attempt to add a result for the same source:target pair.
                    if (cookbookCache.TryGetValue(cookbook.SourceWCID, out var sourceRecipes))
                    {
                        if (!sourceRecipes.ContainsKey(cookbook.TargetWCID))
                            sourceRecipes.Add(cookbook.TargetWCID, cookbook);
                    }
                    else
                        cookbookCache.Add(cookbook.SourceWCID, new Dictionary<uint, CookBook>() { { cookbook.TargetWCID, cookbook } });
                }
            }

            // build secondary index for RecipeManager_New caching
            lock (recipeCache)
            {
                foreach (var cookbook in cookbooks)
                {
                    if (!recipeCache.ContainsKey(cookbook.RecipeId))
                        recipeCache.Add(cookbook.RecipeId, cookbook.Recipe);
                }
            }

            return cookbooks;
        }

19 Source : WorldDatabaseWithEntityCache.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override Recipe GetRecipe(WorldDbContext context, uint recipeId)
        {
            var recipe = base.GetRecipe(context, recipeId);

            lock (recipeCache)
            {
                if (!recipeCache.ContainsKey(recipeId))
                    recipeCache.Add(recipeId, recipe);
            }
            return recipe;
        }

19 Source : ClothingTable.cs
with GNU Affero General Public License v3.0
from ACEmulator

public CoverageMask? GetVisualPriority(uint setupId = 0x02000001)
        {
            if (ClothingBaseEffects.ContainsKey(setupId))
            {
                CoverageMask visualPriority = 0;
                foreach (CloObjectEffect t in ClothingBaseEffects[setupId].CloObjectEffects)
                    switch (t.Index)
                    {
                        case 0: // HUMAN_ABDOMEN;
                            visualPriority |= CoverageMask.OuterwearAbdomen;
                            break;
                        case 1: // HUMAN_LEFT_UPPER_LEG;
                        case 5: // HUMAN_RIGHT_UPPER_LEG;
                            visualPriority |= CoverageMask.OuterwearUpperLegs;
                            break;
                        case 2: // HUMAN_LEFT_LOWER_LEG;
                        case 6: // HUMAN_RIGHT_LOWER_LEG;
                            visualPriority |= CoverageMask.OuterwearLowerLegs;
                            break;
                        case 3: // HUMAN_LEFT_FOOT;
                        case 4: // HUMAN_LEFT_TOE;
                        case 7: // HUMAN_RIGHT_FOOT;
                        case 8: // HUMAN_RIGHT_TOE;
                            visualPriority |= CoverageMask.Feet;
                            break;
                        case 9: // HUMAN_CHEST;
                            visualPriority |= CoverageMask.OuterwearChest;
                            break;
                        case 10: // HUMAN_LEFT_UPPER_ARM;
                        case 13: // HUMAN_RIGHT_UPPER_ARM;
                            visualPriority |= CoverageMask.OuterwearUpperArms;
                            break;
                        case 11: // HUMAN_LEFT_LOWER_ARM;
                        case 14: // HUMAN_RIGHT_LOWER_ARM;
                            visualPriority |= CoverageMask.OuterwearLowerArms;
                            break;
                        case 12: // HUMAN_LEFT_HAND;
                        case 15: // HUMAN_RIGHT_HAND;
                            visualPriority |= CoverageMask.Hands;
                            break;
                        case 16: // HUMAN_HEAD;
                            visualPriority |= CoverageMask.Head;
                            break;
                        default: // Lots of things we don't care about
                            break;
                    }
                return visualPriority;
            }
            else
                return null;            
        }

19 Source : MotionTable.cs
with GNU Affero General Public License v3.0
from ACEmulator

private MotionCommand GetDefaultMotion(MotionStance style)
        {
            if (StyleDefaults.ContainsKey((uint)style))
                return (MotionCommand)StyleDefaults[(uint)style];

            return MotionCommand.Invalid;
        }

19 Source : MotionTable.cs
with GNU Affero General Public License v3.0
from ACEmulator

public ACE.Enreplacedy.Position GetAnimationFinalPositionFromStart(ACE.Enreplacedy.Position position, float objScale, MotionCommand currentMotionState, MotionStance style, MotionCommand motion)
        {
            float length = 0; // init our length var...will return as 0 if not found

            ACE.Enreplacedy.Position finalPosition = new ACE.Enreplacedy.Position();

            uint motionHash = ((uint)currentMotionState & 0xFFFFFF) | ((uint)style << 16);

            if (Links.ContainsKey(motionHash))
            {
                Dictionary<uint, MotionData> links = Links[motionHash];

                if (links.ContainsKey((uint)motion))
                {
                    // loop through all that animations to get our total count
                    for (int i = 0; i < links[(uint)motion].Anims.Count; i++)
                    {
                        AnimData anim = links[(uint)motion].Anims[i];

                        uint numFrames;

                        // check if the animation is set to play the whole thing, in which case we need to get the numbers of frames in the raw animation
                        if ((anim.LowFrame == 0) && (anim.HighFrame == -1))
                        {
                            var animation = DatManager.PortalDat.ReadFromDat<Animation>(anim.AnimId);
                            numFrames = animation.NumFrames;

                            if (animation.PosFrames.Count > 0)
                            {
                                finalPosition = position;
                                var origin = new Vector3(position.PositionX, position.PositionY, position.PositionZ);
                                var orientation = new Quaternion(position.RotationX, position.RotationY, position.RotationZ, position.RotationW);
                                foreach (var posFrame in animation.PosFrames)
                                {
                                    origin += Vector3.Transform(posFrame.Origin, orientation) * objScale;

                                    orientation *= posFrame.Orientation;
                                    orientation = Quaternion.Normalize(orientation);
                                }

                                finalPosition.PositionX = origin.X;
                                finalPosition.PositionY = origin.Y;
                                finalPosition.PositionZ = origin.Z;

                                finalPosition.RotationW = orientation.W;
                                finalPosition.RotationX = orientation.X;
                                finalPosition.RotationY = orientation.Y;
                                finalPosition.RotationZ = orientation.Z;
                            }
                            else
                                return position;
                        }
                        else
                            numFrames = (uint)(anim.HighFrame - anim.LowFrame);

                        length += numFrames / Math.Abs(anim.Framerate); // Framerates can be negative, which tells the client to play in reverse
                    }
                }
            }

            return finalPosition;
        }

19 Source : DeveloperDatabaseCommands.cs
with GNU Affero General Public License v3.0
from ACEmulator

[CommandHandler("fix-shortcut-bars", AccessLevel.Admin, CommandHandlerFlag.ConsoleInvoke, "Fixes the players with duplicate items on their shortcut bars.", "<execute>")]
        public static void HandleFixShortcutBars(Session session, params string[] parameters)
        {
            Console.WriteLine();

            Console.WriteLine("This command will attempt to fix duplicate shortcuts found in player shortcut bars. Unless explictly indicated, command will dry run only");
            Console.WriteLine("If the command outputs nothing or errors, you are ready to proceed with updating your shard db with 2019-04-17-00-Character_Shortcut_Changes.sql script");

            Console.WriteLine();

            var execute = false;

            if (parameters.Length < 1)
                Console.WriteLine("This will be a dry run and show which characters that would be affected. To perform fix, please use command: fix-shortcut-bars execute");
            else if (parameters[0].ToLower() == "execute")
                execute = true;
            else
                Console.WriteLine("Please use command fix-shortcut-bars execute");

            using (var ctx = new ShardDbContext())
            {
                var results = ctx.CharacterPropertiesShortcutBar
                    .FromSqlRaw("SELECT * FROM character_properties_shortcut_bar ORDER BY character_Id, shortcut_Bar_Index, id")
                    .ToList();

                var sqlCommands = new List<string>();

                uint characterId = 0;
                string playerName = null;
                var idxToObj = new Dictionary<uint, uint>();
                var objToIdx = new Dictionary<uint, uint>();
                var buggedChar = false;
                var buggedPlayerCount = 0;

                foreach (var result in results)
                {
                    if (characterId != result.CharacterId)
                    {
                        if (buggedChar)
                        {
                            buggedPlayerCount++;
                            Console.WriteLine($"Player {playerName} ({characterId}) was found to have errors in their shortcuts.");
                            sqlCommands.AddRange(OutputShortcutSQLCommand(playerName, characterId, idxToObj));
                            buggedChar = false;
                        }

                        // begin parsing new character
                        characterId = result.CharacterId;
                        var player = PlayerManager.FindByGuid(characterId);
                        playerName = player != null ? player.Name : $"{characterId:X8}";
                        idxToObj = new Dictionary<uint, uint>();
                        objToIdx = new Dictionary<uint, uint>();
                    }

                    var dupeIdx = idxToObj.ContainsKey(result.ShortcutBarIndex);
                    var dupeObj = objToIdx.ContainsKey(result.ShortcutObjectId);

                    if (dupeIdx || dupeObj)
                    {
                        //Console.WriteLine($"Player: {playerName}, Idx: {result.ShortcutBarIndex}, Obj: {result.ShortcutObjectId:X8} ({result.Id})");
                        buggedChar = true;
                    }

                    objToIdx[result.ShortcutObjectId] = result.ShortcutBarIndex;

                    if (!dupeObj)
                        idxToObj[result.ShortcutBarIndex] = result.ShortcutObjectId;
                }

                if (buggedChar)
                {
                    Console.WriteLine($"Player {playerName} ({characterId}) was found to have errors in their shortcuts.");
                    buggedPlayerCount++;
                    sqlCommands.AddRange(OutputShortcutSQLCommand(playerName, characterId, idxToObj));
                }

                Console.WriteLine($"Total players found with bugged shortcuts: {buggedPlayerCount}");

                if (execute)
                {
                    Console.WriteLine("Executing changes...");

                    foreach (var cmd in sqlCommands)
                        ctx.Database.ExecuteSqlRaw(cmd);
                }
                else
                    Console.WriteLine("dry run completed. Use fix-shortcut-bars execute to actually run command");
            }
        }

19 Source : SpellFormula.cs
with GNU Affero General Public License v3.0
from ACEmulator

public Dictionary<uint, int> GetRequiredComps()
        {
            var compsRequired = new Dictionary<uint, int>();

            foreach (var component in CurrentFormula)
            {
                var wcid = Spell.GetComponentWCID(component);

                if (compsRequired.ContainsKey(wcid))
                    compsRequired[wcid]++;
                else
                    compsRequired.Add(wcid, 1);
            }
            return compsRequired;
        }

19 Source : StaticMeshCache.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static bool Contains(uint id)
        {
            return Meshes.ContainsKey(id);
        }

19 Source : Tailoring.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static void SetArmorProperties(WorldObject source, WorldObject target)
        {
            SetCommonProperties(source, target);

            // ensure armor/clothing that covers head/hands/feet are cross-compatible
            // for something like shirt/breastplate, this will still be be prevented with ClothingPriority / CoverageMask check
            // (Outerwear vs. Underwear)
            target.TargetType = ItemType.Armor | ItemType.Clothing;

            target.ClothingPriority = source.ClothingPriority;
            target.Dyable = source.Dyable;

            // If this source item is one of the icons that contains an icon overlay as part of it, we will stash that icon in the
            // IconOverlaySecondary slot (it is unused) to be applied on the next step.
            if (ArmorOverlayIcons.ContainsKey(source.WeenieClreplacedId) && source.IconOverlayId.HasValue)
                target.SetProperty(PropertyDataId.IconOverlaySecondary, (uint)source.IconOverlayId);

            // ObjDescOverride.Clear()
        }

19 Source : Tailoring.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static void UpdateArmorProps(Player player, WorldObject source, WorldObject target)
        {
            UpdateCommonProps(player, source, target);

            player.UpdateProperty(target, PropertyBool.Dyable, source.Dyable);

            // If the item we are replacing is one of our preset icons with an overlay, we need to remove it.
            if (ArmorOverlayIcons.ContainsKey(target.WeenieClreplacedId))
                player.UpdateProperty(target, PropertyDataId.IconOverlay, null);

            // If the source item has an icon stashed in the Secondary Overlay, it's because we put it there!
            // Apply this overlay if the target does not already have one.
            if (source.GetProperty(PropertyDataId.IconOverlaySecondary).HasValue && !target.IconOverlayId.HasValue)
                player.UpdateProperty(target, PropertyDataId.IconOverlay, source.GetProperty(PropertyDataId.IconOverlaySecondary));

            // ObjDescOverride.Clear()
        }

19 Source : EnvCell.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void build_visible_cells()
        {
            VisibleCells = new Dictionary<uint, EnvCell>();

            foreach (var visibleCellID in VisibleCellIDs)
            {
                var blockCellID = ID & 0xFFFF0000 | visibleCellID;
                if (VisibleCells.ContainsKey(blockCellID)) continue;
                var cell = (EnvCell)LScape.get_landcell(blockCellID);
                VisibleCells.Add(visibleCellID, cell);
            }
        }

19 Source : Fellowship.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void AddFellowshipMember(Player inviter, Player newMember)
        {
            if (inviter == null || newMember == null)
                return;

            if (IsLocked)
            {

                if (!DepartedMembers.TryGetValue(newMember.Guid.Full, out var timeDeparted))
                {
                    inviter.Session.Network.EnqueueSend(new GameEventWeenieErrorWithString(inviter.Session, WeenieErrorWithString.LockedFellowshipCannotRecruit_, newMember.Name));
                    //newMember.SendWeenieError(WeenieError.LockedFellowshipCannotRecruitYou);
                    return;
                }
                else
                {
                    var timeLimit = Time.GetDateTimeFromTimestamp(timeDeparted).AddSeconds(600);
                    if (DateTime.UtcNow > timeLimit)
                    {
                        inviter.Session.Network.EnqueueSend(new GameEventWeenieErrorWithString(inviter.Session, WeenieErrorWithString.LockedFellowshipCannotRecruit_, newMember.Name));
                        //newMember.SendWeenieError(WeenieError.LockedFellowshipCannotRecruitYou);
                        return;
                    }
                }
            }

            if (FellowshipMembers.Count == MaxFellows)
            {
                inviter.Session.Network.EnqueueSend(new GameEventWeenieError(inviter.Session, WeenieError.YourFellowshipIsFull));
                return;
            }

            if (newMember.Fellowship != null || FellowshipMembers.ContainsKey(newMember.Guid.Full))
            {
                inviter.Session.Network.EnqueueSend(new GameMessageSystemChat($"{newMember.Name} is already a member of a Fellowship.", ChatMessageType.Broadcast));
            }
            else
            {
                if (PropertyManager.GetBool("fellow_busy_no_recruit").Item && newMember.IsBusy)
                {
                    inviter.Session.Network.EnqueueSend(new GameMessageSystemChat($"{newMember.Name} is busy.", ChatMessageType.Broadcast));
                    return;
                }

                if (newMember.GetCharacterOption(CharacterOption.AutomaticallyAcceptFellowshipRequests))
                {
                    AddConfirmedMember(inviter, newMember, true);
                }
                else
                {
                    if (!newMember.ConfirmationManager.EnqueueSend(new Confirmation_Fellowship(inviter.Guid, newMember.Guid), inviter.Name))
                    {
                        inviter.Session.Network.EnqueueSend(new GameMessageSystemChat($"{newMember.Name} is busy.", ChatMessageType.Broadcast));
                    }
                }
            }
        }

19 Source : Fellowship.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void RemoveFellowshipMember(Player player, Player leader)
        {
            if (player == null) return;

            var fellowshipMembers = GetFellowshipMembers();

            if (!fellowshipMembers.ContainsKey(player.Guid.Full))
            {
                log.Warn($"{leader.Name} tried to dismiss {player.Name} from the fellowship, but {player.Name} was not found in the fellowship");

                var done = true;

                if (player.Fellowship != null)
                {
                    if (player.Fellowship == this)
                    {
                        log.Warn($"{player.Name} still has a reference to this fellowship somehow. This shouldn't happen");
                        done = false;
                    }
                    else
                        log.Warn($"{player.Name} has a reference to a different fellowship. {leader.Name} is possibly sending crafted data!");
                }

                if (done) return;
            }

            foreach (var member in fellowshipMembers.Values)
            {
                member.Session.Network.EnqueueSend(new GameEventFellowshipDismiss(member.Session, player));
                member.Session.Network.EnqueueSend(new GameMessageSystemChat($"{player.Name} dismissed from fellowship", ChatMessageType.Fellowship));
            }

            FellowshipMembers.Remove(player.Guid.Full);
            player.Fellowship = null;

            CalculateXPSharing();

            UpdateAllMembers();
        }

19 Source : CellArray.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void add_cell(uint cellID, ObjCell cell)
        {
            if (!Cells.ContainsKey(cellID))
            {
                Cells.Add(cellID, cell);
                NumCells++;
            }
        }

19 Source : ObjectMaint.cs
with GNU Affero General Public License v3.0
from ACEmulator

public bool KnownObjectsContainsKey(uint guid)
        {
            rwLock.EnterReadLock();
            try
            {
                return KnownObjects.ContainsKey(guid);
            }
            finally
            {
                rwLock.ExitReadLock();
            }
        }

19 Source : ObjectMaint.cs
with GNU Affero General Public License v3.0
from ACEmulator

public bool AddKnownObject(PhysicsObj obj)
        {
            rwLock.EnterWriteLock();
            try
            {
                if (KnownObjects.ContainsKey(obj.ID))
                    return false;

                KnownObjects.TryAdd(obj.ID, obj);

                // maintain KnownPlayers for both parties
                if (obj.IsPlayer)
                    AddKnownPlayer(obj);

                obj.ObjMaint.AddKnownPlayer(PhysicsObj);

                return true;
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }

19 Source : ObjectMaint.cs
with GNU Affero General Public License v3.0
from ACEmulator

public bool VisibleObjectsContainsKey(uint key)
        {
            rwLock.EnterReadLock();
            try
            {
                return VisibleObjects.ContainsKey(key);
            }
            finally
            {
                rwLock.ExitReadLock();
            }
        }

19 Source : EnvCell.cs
with GNU Affero General Public License v3.0
from ACEmulator

public bool IsVisibleIndoors(ObjCell cell)
        {
            var blockDist = PhysicsObj.GetBlockDist(ID, cell.ID);

            // if landblocks equal
            if (blockDist == 0)
            {
                // check env VisibleCells
                var cellID = cell.ID & 0xFFFF;
                if (VisibleCells.ContainsKey(cellID))
                    return true;
            }
            return SeenOutside && blockDist <= 1;
        }

19 Source : ObjectMaint.cs
with GNU Affero General Public License v3.0
from ACEmulator

public bool AddVisibleObject(PhysicsObj obj)
        {
            rwLock.EnterWriteLock();
            try
            {
                if (VisibleObjects.ContainsKey(obj.ID))
                    return false;

                if (InitialClamp && !KnownObjects.ContainsKey(obj.ID))
                {
                    var distSq = PhysicsObj.Position.Distance2DSquared(obj.Position);

                    if (distSq > InitialClamp_DistSq)
                        return false;
                }

                //Console.WriteLine($"{PhysicsObj.Name}.AddVisibleObject({obj.Name})");
                VisibleObjects.TryAdd(obj.ID, obj);

                if (obj.WeenieObj.IsMonster)
                    obj.ObjMaint.AddVisibleTarget(PhysicsObj, false);

                return true;
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }

19 Source : CellArray.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void remove_cell(ObjCell cell)
        {
            if (Cells.ContainsKey(cell.ID))
            {
                Cells.Remove(cell.ID);
                NumCells--;
            }
        }

19 Source : ObjectMaint.cs
with GNU Affero General Public License v3.0
from ACEmulator

private bool AddKnownPlayer(PhysicsObj obj)
        {
            // only tracking players who know about this object
            if (!obj.IsPlayer)
            {
                Console.WriteLine($"{PhysicsObj.Name}.ObjectMaint.AddKnownPlayer({obj.Name}): tried to add a non-player");
                return false;
            }
            if (PhysicsObj.DatObject)
            {
                Console.WriteLine($"{PhysicsObj.Name}.ObjectMaint.AddKnownPlayer({obj.Name}): tried to add player for dat object");
                return false;
            }

            //Console.WriteLine($"{PhysicsObj.Name} ({PhysicsObj.ID:X8}).ObjectMaint.AddKnownPlayer({obj.Name})");

            // TryAdd for existing keys still modifies collection?
            if (KnownPlayers.ContainsKey(obj.ID))
                return false;

            KnownPlayers.TryAdd(obj.ID, obj);
            return true;
        }

19 Source : ObjectMaint.cs
with GNU Affero General Public License v3.0
from ACEmulator

public bool VisibleTargetsContainsKey(uint key)
        {
            rwLock.EnterReadLock();
            try
            {
                return VisibleTargets.ContainsKey(key);
            }
            finally
            {
                rwLock.ExitReadLock();
            }
        }

19 Source : ObjectMaint.cs
with GNU Affero General Public License v3.0
from ACEmulator

public bool RetaliateTargetsContainsKey(uint key)
        {
            rwLock.EnterReadLock();
            try
            {
                return RetaliateTargets.ContainsKey(key);
            }
            finally
            {
                rwLock.ExitReadLock();
            }
        }

19 Source : ObjectMaint.cs
with GNU Affero General Public License v3.0
from ACEmulator

private bool AddVisibleTarget(PhysicsObj obj, bool clamp = true, bool foeType = false)
        {
            if (PhysicsObj.WeenieObj.IsCombatPet)
            {
                // only tracking monsters
                if (!obj.WeenieObj.IsMonster)
                {
                    Console.WriteLine($"{PhysicsObj.Name}.ObjectMaint.AddVisibleTarget({obj.Name}): tried to add a non-monster");
                    return false;
                }
            }
            else if (PhysicsObj.WeenieObj.IsFactionMob)
            {
                // only tracking players, combat pets, and monsters of differing faction
                if (!obj.IsPlayer && !obj.WeenieObj.IsCombatPet && (!obj.WeenieObj.IsMonster || PhysicsObj.WeenieObj.SameFaction(obj)))
                {
                    Console.WriteLine($"{PhysicsObj.Name}.ObjectMaint.AddVisibleTarget({obj.Name}): tried to add a non-player / non-combat pet / non-opposing faction mob");
                    return false;
                }
            }
            else
            {
                // handle special case:
                // we want to select faction mobs for monsters inverse targets,
                // but not add to the original monster
                if (obj.WeenieObj.IsFactionMob)
                {
                    obj.ObjMaint.AddVisibleTarget(PhysicsObj);
                    return false;
                }

                // handle special case:
                // if obj has a FoeType of this creature, and this creature doesn't have a FoeType for obj,
                // we only want to perform the inverse
                if (obj.WeenieObj.FoeType != null && obj.WeenieObj.FoeType == PhysicsObj.WeenieObj.WorldObject?.CreatureType &&
                    (PhysicsObj.WeenieObj.FoeType == null || obj.WeenieObj.WorldObject != null && PhysicsObj.WeenieObj.FoeType != obj.WeenieObj.WorldObject.CreatureType))
                {
                    obj.ObjMaint.AddVisibleTarget(PhysicsObj);
                    return false;
                }

                // only tracking players and combat pets
                if (!obj.IsPlayer && !obj.WeenieObj.IsCombatPet && PhysicsObj.WeenieObj.FoeType == null)
                {
                    Console.WriteLine($"{PhysicsObj.Name}.ObjectMaint.AddVisibleTarget({obj.Name}): tried to add a non-player / non-combat pet");
                    return false;
                }
            }
            if (PhysicsObj.DatObject)
            {
                Console.WriteLine($"{PhysicsObj.Name}.ObjectMaint.AddVisibleTarget({obj.Name}): tried to add player for dat object");
                return false;
            }

            if (clamp && InitialClamp && obj.IsPlayer && !obj.ObjMaint.KnownObjects.ContainsKey(obj.ID))
            {
                var distSq = PhysicsObj.Position.Distance2DSquared(obj.Position);

                if (distSq > InitialClamp_DistSq)
                    return false;
            }

            // TryAdd for existing keys still modifies collection?
            if (VisibleTargets.ContainsKey(obj.ID))
                return false;

            //Console.WriteLine($"{PhysicsObj.Name} ({PhysicsObj.ID:X8}).ObjectMaint.AddVisibleTarget({obj.Name})");

            VisibleTargets.Add(obj.ID, obj);

            // maintain inverse for monsters / combat pets
            if (!obj.IsPlayer)
                obj.ObjMaint.AddVisibleTarget(PhysicsObj);

            return true;
        }

19 Source : ObjectMaint.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void AddRetaliateTarget(PhysicsObj obj)
        {
            rwLock.EnterWriteLock();
            try
            {
                if (RetaliateTargets.ContainsKey(obj.ID))
                {
                    //Console.WriteLine($"{PhysicsObj.Name}.AddRetaliateTarget({obj.Name}) - retaliate target already exists");
                    return;
                }
                //Console.WriteLine($"{PhysicsObj.Name}.AddRetaliateTarget({obj.Name})");
                RetaliateTargets.Add(obj.ID, obj);

                // we're going to add retaliate targets to the list of visible targets as well,
                // so that we don't have to traverse both VisibleTargets and RetaliateTargets
                // in all of the logic based on VisibleTargets
                if (VisibleTargets.ContainsKey(obj.ID))
                {
                    //Console.WriteLine($"{PhysicsObj.Name}.AddRetaliateTarget({obj.Name}) - visible target already exists");
                    return;
                }
                VisibleTargets.Add(obj.ID, obj);
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }

19 Source : ContractManager.cs
with GNU Affero General Public License v3.0
from ACEmulator

private void RefreshMonitoredQuestFlags()
        {
            MonitoredQuestFlags.Clear();

            var contracts = Player.Character.GetContracts(Player.CharacterDatabaseLock);

            foreach (var contract in contracts)
            {
                var datContract = GetContractFromDat(contract.ContractId);

                if (!MonitoredQuestFlags.ContainsKey(contract.ContractId))
                    MonitoredQuestFlags.Add(contract.ContractId, new HashSet<string>());

                if (!string.IsNullOrWhiteSpace(datContract.QuestflagFinished))
                    MonitoredQuestFlags[datContract.ContractId].Add(datContract.QuestflagFinished.ToLower());
                if (!string.IsNullOrWhiteSpace(datContract.QuestflagProgress))
                    MonitoredQuestFlags[datContract.ContractId].Add(datContract.QuestflagProgress.ToLower());
                if (!string.IsNullOrWhiteSpace(datContract.QuestflagRepeatTime))
                    MonitoredQuestFlags[datContract.ContractId].Add(datContract.QuestflagRepeatTime.ToLower());
                if (!string.IsNullOrWhiteSpace(datContract.QuestflagStamped))
                    MonitoredQuestFlags[datContract.ContractId].Add(datContract.QuestflagStamped.ToLower());
                if (!string.IsNullOrWhiteSpace(datContract.QuestflagStarted))
                    MonitoredQuestFlags[datContract.ContractId].Add(datContract.QuestflagStarted.ToLower());
                if (!string.IsNullOrWhiteSpace(datContract.QuestflagTimer))
                    MonitoredQuestFlags[datContract.ContractId].Add(datContract.QuestflagTimer.ToLower());
            }
        }

19 Source : Allegiance.cs
with GNU Affero General Public License v3.0
from ACEmulator

public bool IsBanned(uint playerGuid)
        {
            return BanList.ContainsKey(playerGuid);
        }

19 Source : Allegiance.cs
with GNU Affero General Public License v3.0
from ACEmulator

public bool HasApprovedVreplacedal(uint playerGuid)
        {
            return ApprovedVreplacedals.ContainsKey(playerGuid);
        }

19 Source : Player_Commerce.cs
with GNU Affero General Public License v3.0
from ACEmulator

private Dictionary<uint, WorldObject> VerifySellItems(List<ItemProfile> sellItems, Vendor vendor)
        {
            var allPossessions = GetAllPossessions().ToDictionary(i => i.Guid.Full, i => i);

            var acceptedItemTypes = (ItemType)(vendor.MerchandiseItemTypes ?? 0);

            var verified = new Dictionary<uint, WorldObject>();

            foreach (var sellItem in sellItems)
            {
                if (!allPossessions.TryGetValue(sellItem.ObjectGuid, out var wo))
                {
                    log.Warn($"[VENDOR] {Name} tried to sell item {sellItem.ObjectGuid:X8} not in their inventory to {vendor.Name}");
                    continue;
                }

                // verify item profile (unique guids, amount)
                if (verified.ContainsKey(wo.Guid.Full))
                {
                    log.Warn($"[VENDOR] {Name} tried to sell duplicate item {wo.Name} ({wo.Guid}) to {vendor.Name}");
                    continue;
                }

                if (!sellItem.IsValidAmount)
                {
                    log.Warn($"[VENDOR] {Name} tried to sell {sellItem.Amount}x {wo.Name} ({wo.Guid}) to {vendor.Name}");
                    continue;
                }

                if (sellItem.Amount > (wo.StackSize ?? 1))
                {
                    log.Warn($"[VENDOR] {Name} tried to sell {sellItem.Amount}x {wo.Name} ({wo.Guid}) to {vendor.Name}, but they only have {wo.StackSize ?? 1}x");
                    continue;
                }

                // verify wo / vendor / player properties
                if ((acceptedItemTypes & wo.ItemType) == 0 || !wo.IsSellable || wo.Retained)
                {
                    var itemName = (wo.StackSize ?? 1) > 1 ? wo.GetPluralName() : wo.Name;
                    Session.Network.EnqueueSend(new GameEventCommunicationTransientString(Session, $"The {itemName} is unsellable.")); // retail message did not include item name, leaving in that for now.
                    continue;
                }

                if (wo.Value < 1)
                {
                    var itemName = (wo.StackSize ?? 1) > 1 ? wo.GetPluralName() : wo.Name;
                    Session.Network.EnqueueSend(new GameEventCommunicationTransientString(Session, $"The {itemName} has no value and cannot be sold.")); // retail message did not include item name, leaving in that for now.
                    continue;
                }

                if (IsTrading && wo.IsBeingTradedOrContainsItemBeingTraded(ItemsInTradeWindow))
                {
                    var itemName = (wo.StackSize ?? 1) > 1 ? wo.GetPluralName() : wo.Name;
                    Session.Network.EnqueueSend(new GameEventCommunicationTransientString(Session, $"You cannot sell that! The {itemName} is currently being traded.")); // custom message?
                    continue;
                }

                verified.Add(wo.Guid.Full, wo);
            }

            return verified;
        }

19 Source : R_Landblock.cs
with GNU General Public License v3.0
from ACEmulator

public void BuildTextures()
        {
            foreach (var poly in Landblock.Polygons)
            {
                var surfnum = (uint)poly.PosSurface;
                if (LandOverlays.ContainsKey(surfnum))
                    continue;

                var surface = LandSurf.Instance.GetLandSurface(surfnum);
                var surfInfo = surface.Info;

                var texID = surfInfo.TerrainBase.TexGID;
                var baseTexture = TextureCache.Get(texID);
                var numLevels = baseTexture.LevelCount;
                var numColors = baseTexture.Width * baseTexture.Height;
                //var data = new Color[numColors];
                //baseTexture.GetData(data, 0, numColors);

                var mipData = baseTexture.GetMipData(numColors);

                var overlays = new Texture2D(GraphicsDevice, baseTexture.Width, baseTexture.Height, TextureCache.UseMipMaps, SurfaceFormat.Color, 5);
                //overlays.SetData(0, 0, null, data, 0, numColors);
                for (var j = 0; j < numLevels; j++)
                    overlays.SetData(j, 0, null, mipData[j], 0, mipData[j].Length);

                // terrain overlays
                for (var i = 0; i < surfInfo.TerrainOverlays.Count; i++)
                {
                    var overlayID = surfInfo.TerrainOverlays[i].TexGID;
                    var overlayTexture = TextureCache.Get(overlayID);
                    //data = new Color[numColors];
                    //overlayTexture.GetData(data, 0, numColors);
                    mipData = overlayTexture.GetMipData(numColors);

                    //overlays.SetData(0, i + 1, null, data, 0, numColors);
                    for (var j = 0; j < numLevels; j++)
                        overlays.SetData(j, i + 1, null, mipData[j], 0, mipData[j].Length);
                }

                // road overlay
                if (surfInfo.RoadOverlay != null)
                {
                    var overlayID = surfInfo.RoadOverlay.TexGID;
                    var overlayTexture = TextureCache.Get(overlayID);
                    //data = new Color[numColors];
                    //overlayTexture.GetData(data, 0, numColors);
                    mipData = overlayTexture.GetMipData(numColors);

                    //overlays.SetData(0, 4, null, data, 0, numColors);
                    for (var j = 0; j < numLevels; j++)
                        overlays.SetData(j, 4, null, mipData[j], 0, mipData[j].Length);
                }

                //Console.WriteLine($"Adding {surfnum}");
                LandOverlays.Add(surfnum, overlays);

                var alphas = new Texture2D(GraphicsDevice, baseTexture.Width, baseTexture.Height, false, SurfaceFormat.Alpha8, 6);

                // terrain alphas
                for (var i = 0; i < surfInfo.TerrainAlphaOverlays.Count; i++)
                {
                    var alphaID = surfInfo.TerrainAlphaOverlays[i].TexGID;
                    var alphaTexture = TextureCache.Get(alphaID);
                    var alphaData = new byte[numColors];
                    alphaTexture.GetData(alphaData, 0, numColors);

                    alphas.SetData(0, i + 1, null, alphaData, 0, numColors);
                }

                // road alphas
                for (var i = 0; i < surfInfo.RoadAlphaOverlays.Count; i++)
                {
                    var alphaID = surfInfo.RoadAlphaOverlays[i].RoadTexGID;
                    var alphaTexture = TextureCache.Get(alphaID);
                    var alphaData = new byte[numColors];
                    alphaTexture.GetData(alphaData, 0, numColors);

                    alphas.SetData(0, i + 4, null, alphaData, 0, numColors);
                }

                LandAlphas.Add(surfnum, alphas);
            }
        }

19 Source : ObjectMaint.cs
with GNU General Public License v3.0
from ACEmulator

public bool AddObject(PhysicsObj obj)
        {
            if (!ObjectTable.ContainsKey(obj.ID))
            {
                ObjectTable.Add(obj.ID, obj);

                // add to target object's voyeurs
                obj.ObjMaint.AddVoyeur(PhysicsObj);

                return true;
            }
            return false;
        }

19 Source : ObjectMaint.cs
with GNU General Public License v3.0
from ACEmulator

public bool AddVisibleObject(PhysicsObj obj)
        {
            if (!VisibleObjectTable.ContainsKey(obj.ID))
            {
                VisibleObjectTable.Add(obj.ID, obj);
                return true;
            }
            return false;
        }

19 Source : ObjectMaint.cs
with GNU General Public License v3.0
from ACEmulator

public static void AddServerObject(PhysicsObj obj)
        {
            if (obj == null) return;

            if (ServerObjects.ContainsKey(obj.ID))
                ServerObjects[obj.ID] = obj;
            else
                ServerObjects.Add(obj.ID, obj);
        }

19 Source : ObjectMaint.cs
with GNU General Public License v3.0
from ACEmulator

public static void RemoveServerObject(PhysicsObj obj)
        {
            if (obj == null) return;

            if (ServerObjects.ContainsKey(obj.ID))
                ServerObjects.Remove(obj.ID);
        }

19 Source : ObjectMaint.cs
with GNU General Public License v3.0
from ACEmulator

public bool AddVoyeur(PhysicsObj obj)
        {
            // only tracking players who know about each object
            if (!obj.IsPlayer)
                return false;

            if (!VoyeurTable.ContainsKey(obj.ID))
            {
                VoyeurTable.Add(obj.ID, obj);
                return true;
            }
            return false;
        }

19 Source : SpellComponent.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static bool IsValid(uint wcid)
        {
            return SpellComponentWCIDs.ContainsKey(wcid);
        }

See More Examples