Ejemplo n.º 1
0
        public static Packet RemoveDoor(MysticDoor door, byte leaveType)
        {
            Packet pw = new Packet(ServerMessages.TOWN_PORTAL_REMOVED);

            pw.WriteByte(leaveType);
            pw.WriteInt(door.OwnerId);
            return(pw);
        }
Ejemplo n.º 2
0
        public void PartyDoorCreated(MysticDoor door)
        {
            Packet pw = new Packet(ISClientMessages.PartyDoorChanged);

            pw.WriteInt(door.OwnerId);
            pw.WriteInt(DataProvider.Maps[door.FieldId].ReturnMap);
            pw.WriteInt(door.FieldId);
            pw.WriteShort(door.X);
            pw.WriteShort(door.Y);
            SendPacket(pw);
        }
Ejemplo n.º 3
0
        public static Packet ShowDoor(MysticDoor door, byte enterType)
        {
            Packet pw = new Packet(ServerMessages.TOWN_PORTAL_CREATED);

            pw.WriteByte(enterType); //Does this decide if the animation plays when it is shown?
            pw.WriteInt(door.OwnerId);
            pw.WriteShort(door.X);
            pw.WriteShort(door.Y);

            Trace.WriteLine($"Spawning Door @ {door.X} {door.Y}, owner {door.OwnerId}");

            return(pw);
        }
Ejemplo n.º 4
0
        public void CreateDoor(Character chr, short x, short y, long endTime)
        {
            var door = new MysticDoor(chr.ID, chr.PartyID, x, y, Field.ID, endTime);

            Doors.Add(chr.ID, door);
            Field.SendPacket(MapPacket.ShowDoor(door, 0));

            DataProvider.Maps[Field.ReturnMap].DoorPool.DoorsLeadingHere.Add(chr.ID, door);

            //Owner is never in town when spawning door out of town, so no need to send portal spawn packet til he enters town

            if (door.OwnerPartyId != 0)
            {
                Server.Instance.CenterConnection.PartyDoorCreated(door);
            }
        }
Ejemplo n.º 5
0
        public void ChangeMap(int mapid, byte partyMemberIdx, MysticDoor door)
        {
            var prevmap = Field;
            var newMap  = DataProvider.Maps[mapid];

            StartChangeMap(prevmap, newMap);
            {
                // Something magical happens I suppose.
                // However, the server doesnt update the position
                // When a random portal is assigned, which would trigger a hack check.
                // So we are a bit clueless...
                MapPosition = (byte)(partyMemberIdx | (1 << 7));
                if (newMap.Town)
                {
                    Portal endingAt;
                    if (newMap.DoorPoints.Count > partyMemberIdx)
                    {
                        // Pick the one for the index
                        endingAt = newMap.DoorPoints[partyMemberIdx];
                    }
                    else
                    {
                        // Random.
                        endingAt = newMap.GetRandomStartPoint();
                    }
                    Position = new Pos(endingAt.X, endingAt.Y);
                }
                else
                {
                    Position = new Pos(door.X, door.Y);
                }

                Stance   = 0;
                Foothold = 0;
            }
            FinishChangeMap(prevmap, newMap);
        }
Ejemplo n.º 6
0
 public bool TryGetDoor(int charId, out MysticDoor door)
 {
     return(Doors.TryGetValue(charId, out door));
 }