GetObjectIndex() public static method

public static GetObjectIndex ( uint ObjectId ) : int
ObjectId uint
return int
Beispiel #1
0
 public static void OnDeSpawn(uint monsterid)
 {
     if (monsterid != 0)
     {
         PacketWriter writer = new PacketWriter();
         writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_DESPAWN);
         writer.AppendDword(monsterid);
         int ObjectIndex = Players.GetObjectIndex(monsterid);
         ServerSocket.SendPacketIfMonsterIsSpawned(writer.getWorkspace(), ObjectIndex);
     }
 }
Beispiel #2
0
        public static void KillMonster(PacketReader reader_, int Index_)
        {
            uint ObjectId = reader_.ReadDword();

            int ObjectIndex = Players.GetObjectIndex(ObjectId);

            ServerSocket.SendPacketIfMonsterIsSpawned(Players.CreateDeSpawnPacket(ObjectId), ObjectIndex);

            for (int i = 0; i <= Monsters.MonsterAmount; i++)
            {
                if (Monsters.General[i].ID == ObjectId)
                {
                    Timers.MonsterAttack[i].Stop();
                    Timers.MonsterMovement[i].Stop();
                    break;
                }
            }
        }
Beispiel #3
0
        public static void OnUnique(uint monsterid, bool kill, string name)
        {
            PacketWriter writer = new PacketWriter();

            writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_UNIQUE);
            if (kill)
            {
                writer.AppendByte(6);
                writer.AppendDword(monsterid);
                writer.AppendWord((ushort)name.Length);
                writer.AppendString(false, name);
            }
            else
            {
                writer.AppendByte(5);
                writer.AppendDword(monsterid);
            }

            int ObjectIndex = Players.GetObjectIndex(monsterid);

            ServerSocket.SendPacketIfMonsterIsSpawned(writer.getWorkspace(), ObjectIndex);
        }