Beispiel #1
0
            public void ConvertToBones()
            {
                WorldServiceLocator._WorldServer.CharacterDatabase.Update($"DELETE FROM corpse WHERE player = \"{Owner}\";");
                Flags = 5;
                Owner = 0uL;
                int j = 0;

                checked
                {
                    do
                    {
                        Items[j] = 0;
                        j++;
                    }while (j <= 18);
                    Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_UPDATE_OBJECT);
                    try
                    {
                        packet.AddInt32(1);
                        packet.AddInt8(0);
                        Packets.UpdateClass tmpUpdate = new Packets.UpdateClass(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_CORPSE);
                        try
                        {
                            tmpUpdate.SetUpdateFlag(6, 0);
                            tmpUpdate.SetUpdateFlag(35, 5);
                            int i = 0;
                            do
                            {
                                tmpUpdate.SetUpdateFlag(13 + i, 0);
                                i++;
                            }while (i <= 18);
                            CorpseObject updateObject = this;
                            tmpUpdate.AddToPacket(ref packet, ObjectUpdateType.UPDATETYPE_VALUES, ref updateObject);
                            SendToNearPlayers(ref packet);
                        }
                        finally
                        {
                            tmpUpdate.Dispose();
                        }
                    }
                    finally
                    {
                        packet.Dispose();
                    }
                }
            }
Beispiel #2
0
 public void AddToWorld()
 {
     WorldServiceLocator._WS_Maps.GetMapTile(positionX, positionY, ref CellX, ref CellY);
     if (WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY] == null)
     {
         WorldServiceLocator._WS_CharMovement.MAP_Load(CellX, CellY, MapID);
     }
     WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY].CorpseObjectsHere.Add(GUID);
     Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_UPDATE_OBJECT);
     checked
     {
         try
         {
             Packets.UpdateClass tmpUpdate = new Packets.UpdateClass(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_CORPSE);
             try
             {
                 packet.AddInt32(1);
                 packet.AddInt8(0);
                 FillAllUpdateFlags(ref tmpUpdate);
                 Packets.UpdateClass updateClass  = tmpUpdate;
                 CorpseObject        updateObject = this;
                 updateClass.AddToPacket(ref packet, ObjectUpdateType.UPDATETYPE_CREATE_OBJECT, ref updateObject);
             }
             finally
             {
                 tmpUpdate.Dispose();
             }
             short i = -1;
             do
             {
                 short j = -1;
                 do
                 {
                     if ((short)unchecked (CellX + i) >= 0 && (short)unchecked (CellX + i) <= 63 && (short)unchecked (CellY + j) >= 0 && (short)unchecked (CellY + j) <= 63 && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)] != null && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)].PlayersHere.Count > 0)
                     {
                         WS_Maps.TMapTile tMapTile = WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)];
                         ulong[]          list     = tMapTile.PlayersHere.ToArray();
                         ulong[]          array    = list;
                         foreach (ulong plGUID in array)
                         {
                             int num;
                             if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(plGUID))
                             {
                                 WS_PlayerData.CharacterObject characterObject = WorldServiceLocator._WorldServer.CHARACTERs[plGUID];
                                 WS_Base.BaseObject            objCharacter    = this;
                                 num = (characterObject.CanSee(ref objCharacter) ? 1 : 0);
                             }
                             else
                             {
                                 num = 0;
                             }
                             if (num != 0)
                             {
                                 WorldServiceLocator._WorldServer.CHARACTERs[plGUID].client.SendMultiplyPackets(ref packet);
                                 WorldServiceLocator._WorldServer.CHARACTERs[plGUID].corpseObjectsNear.Add(GUID);
                                 SeenBy.Add(plGUID);
                             }
                         }
                     }
                     j = (short)unchecked (j + 1);
                 }while (j <= 1);
                 i = (short)unchecked (i + 1);
             }while (i <= 1);
         }
         finally
         {
             packet.Dispose();
         }
     }
 }
Beispiel #3
0
            public void AddToWorld()
            {
                WorldServiceLocator._WS_Maps.GetMapTile(positionX, positionY, ref CellX, ref CellY);
                if (WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY] == null)
                {
                    WorldServiceLocator._WS_CharMovement.MAP_Load(CellX, CellY, MapID);
                }
                try
                {
                    WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY].DynamicObjectsHere.Add(GUID);
                }
                catch (Exception projectError)
                {
                    ProjectData.SetProjectError(projectError);
                    WorldServiceLocator._WorldServer.Log.WriteLine(LogType.WARNING, "AddToWorld failed MapId: {0} Tile XY: {1} {2} GUID: {3}", MapID, CellX, CellY, GUID);
                    ProjectData.ClearProjectError();
                    return;
                }
                Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_UPDATE_OBJECT);
                packet.AddInt32(1);
                packet.AddInt8(0);
                Packets.UpdateClass tmpUpdate = new Packets.UpdateClass(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_DYNAMICOBJECT);
                FillAllUpdateFlags(ref tmpUpdate);
                Packets.UpdateClass updateClass  = tmpUpdate;
                DynamicObjectObject updateObject = this;

                updateClass.AddToPacket(ref packet, ObjectUpdateType.UPDATETYPE_CREATE_OBJECT_SELF, ref updateObject);
                tmpUpdate.Dispose();
                short i = -1;

                checked
                {
                    do
                    {
                        short j = -1;
                        do
                        {
                            if ((short)unchecked (CellX + i) >= 0 && (short)unchecked (CellX + i) <= 63 && (short)unchecked (CellY + j) >= 0 && (short)unchecked (CellY + j) <= 63 && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)] != null && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)].PlayersHere.Count > 0)
                            {
                                WS_Maps.TMapTile tMapTile = WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)];
                                ulong[]          list     = tMapTile.PlayersHere.ToArray();
                                ulong[]          array    = list;
                                foreach (ulong plGUID in array)
                                {
                                    int num;
                                    if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(plGUID))
                                    {
                                        WS_PlayerData.CharacterObject characterObject = WorldServiceLocator._WorldServer.CHARACTERs[plGUID];
                                        WS_Base.BaseObject            objCharacter    = this;
                                        num = (characterObject.CanSee(ref objCharacter) ? 1 : 0);
                                    }
                                    else
                                    {
                                        num = 0;
                                    }
                                    if (num != 0)
                                    {
                                        WorldServiceLocator._WorldServer.CHARACTERs[plGUID].client.SendMultiplyPackets(ref packet);
                                        WorldServiceLocator._WorldServer.CHARACTERs[plGUID].dynamicObjectsNear.Add(GUID);
                                        SeenBy.Add(plGUID);
                                    }
                                }
                            }
                            j = (short)unchecked (j + 1);
                        }while (j <= 1);
                        i = (short)unchecked (i + 1);
                    }while (i <= 1);
                    packet.Dispose();
                }
            }