Ejemplo n.º 1
0
        public static void SendAnimation(int mapNum, int Anim, int X, int Y, byte LockType = 0, int Lockindex = 0)
        {
            ByteStream buffer = new ByteStream(4);

            buffer.WriteInt32((int)Packets.ServerPackets.SAnimation);
            buffer.WriteInt32(Anim);
            buffer.WriteInt32(X);
            buffer.WriteInt32(Y);
            buffer.WriteInt32(LockType);
            buffer.WriteInt32(Lockindex);

            S_General.AddDebug("Sent SMSG: SAnimation");

            S_NetworkConfig.SendDataToMap(mapNum, ref buffer.Data, buffer.Head);

            buffer.Dispose();
        }
Ejemplo n.º 2
0
        public static void SendProjectileToMap(int mapNum, int ProjectileNum)
        {
            ByteStream buffer;

            buffer = new ByteStream(4);
            buffer.WriteInt32((byte)Packets.ServerPackets.SMapProjectile);

            {
                buffer.WriteInt32(ProjectileNum);
                buffer.WriteInt32(MapProjectiles[mapNum, ProjectileNum].ProjectileNum);
                buffer.WriteInt32(MapProjectiles[mapNum, ProjectileNum].Owner);
                buffer.WriteInt32(MapProjectiles[mapNum, ProjectileNum].OwnerType);
                buffer.WriteInt32(MapProjectiles[mapNum, ProjectileNum].Dir);
                buffer.WriteInt32(MapProjectiles[mapNum, ProjectileNum].X);
                buffer.WriteInt32(MapProjectiles[mapNum, ProjectileNum].Y);
            }

            S_NetworkConfig.SendDataToMap(mapNum, ref buffer.Data, buffer.Head);
            buffer.Dispose();
        }
Ejemplo n.º 3
0
        public static void SendMapItemsToAll(int mapNum)
        {
            int        i;
            ByteStream buffer;

            buffer = new ByteStream(4);

            buffer.WriteInt32((int)Packets.ServerPackets.SMapItemData);

            S_General.AddDebug("Sent SMSG: SMapItemData To All");

            for (i = 1; i <= Constants.MAX_MAP_ITEMS; i++)
            {
                buffer.WriteInt32(modTypes.MapItem[mapNum, i].Num);
                buffer.WriteInt32(modTypes.MapItem[mapNum, i].Value);
                buffer.WriteInt32(modTypes.MapItem[mapNum, i].X);
                buffer.WriteInt32(modTypes.MapItem[mapNum, i].Y);
            }

            S_NetworkConfig.SendDataToMap(mapNum, ref buffer.Data, buffer.Head);

            buffer.Dispose();
        }
Ejemplo n.º 4
0
        public static void SpawnItemSlot(int MapItemSlot, int itemNum, int ItemVal, int mapNum, int x, int y)
        {
            int        i;
            ByteStream buffer = new ByteStream(4);

            // Check for subscript out of range
            if (MapItemSlot <= 0 || MapItemSlot > Constants.MAX_MAP_ITEMS || itemNum < 0 || itemNum > Constants.MAX_ITEMS || mapNum <= 0 || mapNum > S_Instances.MAX_CACHED_MAPS)
            {
                return;
            }

            i = MapItemSlot;

            if (i != 0)
            {
                if (itemNum >= 0 && itemNum <= Constants.MAX_ITEMS)
                {
                    modTypes.MapItem[mapNum, i].Num   = itemNum;
                    modTypes.MapItem[mapNum, i].Value = ItemVal;
                    modTypes.MapItem[mapNum, i].X     = (byte)x;
                    modTypes.MapItem[mapNum, i].Y     = (byte)y;

                    buffer.WriteInt32((int)Packets.ServerPackets.SSpawnItem);
                    buffer.WriteInt32(i);
                    buffer.WriteInt32(itemNum);
                    buffer.WriteInt32(ItemVal);
                    buffer.WriteInt32(x);
                    buffer.WriteInt32(y);

                    S_General.AddDebug("Sent SMSG: SSpawnItem MapItemSlot");

                    S_NetworkConfig.SendDataToMap(mapNum, ref buffer.Data, buffer.Head);
                }
            }

            buffer.Dispose();
        }
Ejemplo n.º 5
0
        public static void SendResourceCacheToMap(int mapNum, int Resource_num)
        {
            int        i;
            ByteStream buffer = new ByteStream(4);

            buffer.WriteInt32((int)Packets.ServerPackets.SResourceCache);
            buffer.WriteInt32(ResourceCache[mapNum].ResourceCount);

            S_General.AddDebug("Sent SMSG: SResourceCache");

            if (ResourceCache[mapNum].ResourceCount > 0)
            {
                var loopTo = ResourceCache[mapNum].ResourceCount;
                for (i = 0; i <= loopTo; i++)
                {
                    buffer.WriteInt32(ResourceCache[mapNum].ResourceData[i].ResourceState);
                    buffer.WriteInt32(ResourceCache[mapNum].ResourceData[i].X);
                    buffer.WriteInt32(ResourceCache[mapNum].ResourceData[i].Y);
                }
            }

            S_NetworkConfig.SendDataToMap(mapNum, ref buffer.Data, buffer.Head);
            buffer.Dispose();
        }