コード例 #1
0
ファイル: Grid.cs プロジェクト: cjs3187607/brightmh
 private void addArea(Area a)
 {
     if (this.areaExists(a.getaID()))
     {
         return;
     }
     this.areas.Add(a.getaID(), a);
 }
コード例 #2
0
ファイル: Grid.cs プロジェクト: cjs3187607/brightmh
        public void sendTo3x3AreaMovement(Character character, Area area, byte[] packet)
        {
            if (!this.areaExists(area))
            {
                return;
            }
            List <int> relistInnitedAreas = new List <int>();

            for (int i = 0; i < 3; i++)
            {
                for (int u = 0; u < 3; u++)
                {
                    Area nearCentral = getArea(new int[] { area.getAreaPosition()[0] - 1 + i, area.getAreaPosition()[1] - 1 + u });
                    if (nearCentral == null)
                    {
                        continue;
                    }
                    foreach (Character characterAround in nearCentral.getCharacters())
                    {
                        if (characterAround == character)
                        {
                            continue;
                        }
                        if (!character.getInnitedAreas().Contains(nearCentral.getaID()))
                        {
                            characterAround.getAccount().mClient.WriteRawPacket(CharacterPackets.extCharPacket(character));
                        }
                        try {
                            Console.WriteLine("AreaMove> Packet sent for {0} from {1}", characterAround.getName(), character.getName());
                            characterAround.getAccount().mClient.WriteRawPacket(packet);
                        }
                        catch (Exception e) {
                            Console.WriteLine(e);
                        }
                    }
                    if (character.getInnitedAreas().Contains(nearCentral.getaID()))
                    {
                        relistInnitedAreas.Add(nearCentral.getaID());
                        continue;
                    }
                    nearCentral.sendAreaInit(character);
                    relistInnitedAreas.Add(nearCentral.getaID());
                }
            }
            character.removeInnitedAreas();
            character.setInnitedAreas(relistInnitedAreas);
        }
コード例 #3
0
ファイル: Grid.cs プロジェクト: cjs3187607/brightmh
 public void sendTo3x3AreaSpawn(Character character, Area area, Boolean just_a_refresh_for_the_world = false)
 {
     if (!this.areaExists(area))
     {
         return;
     }
     character.removeInnitedAreas();
     for (int i = 0; i < 3; i++)
     {
         for (int u = 0; u < 3; u++)
         {
             Area nearCentral = getArea(new int[] { area.getAreaPosition()[0] - 1 + i, area.getAreaPosition()[1] - 1 + u });
             if (nearCentral == null)
             {
                 continue;
             }
             if (!just_a_refresh_for_the_world)
             {
                 nearCentral.sendAreaInit(character);
             }
             foreach (Character characterAround in nearCentral.getCharacters())
             {
                 if (characterAround == character)
                 {
                     continue;
                 }
                 try {
                     Console.WriteLine("AreaSpawn> extCharPacket from: {0} for {1}", character.getName(), characterAround.getName());
                     characterAround.getAccount().mClient.WriteRawPacket(CharacterPackets.extCharPacket(character));
                 }
                 catch (Exception e) {
                     Console.WriteLine(e);
                 }
             }
             character.addInnitedArea(nearCentral.getaID());
             WMap.Instance.addToSynchronizedAreas(area);
         }
     }
 }
コード例 #4
0
ファイル: Grid.cs プロジェクト: cjs3187607/brightmh
 private void addArea(Area a)
 {
     if(this.areaExists(a.getaID())) return;
     this.areas.Add(a.getaID(), a);
 }