예제 #1
0
        public override string Compile()
        {
            //Je pense que mettre ça en cache est con x)
            StringBuilder sb = new StringBuilder("Wp");

            sb.Append(character.Map);
            int subAreaID = character.myMap.subArea.area.superArea.ID;

            foreach (Prisme prisma in PrismeTable.Cache.Values.Where(x => x.Alignement == character.Alignement))
            {
                short mapid = prisma.Mapid;
                if (MapTable.Get(mapid) == null || MapTable.Get(mapid).subArea.area.superArea.ID != subAreaID)
                {
                    continue;
                }
                if (prisma.CurrentFight != null || prisma.inFight == -2)
                {
                    sb.Append("|" + mapid + ";*");
                }
                else
                {
                    int costo = ZaapTable.calculZaapCost(character.myMap, (MapTable.Get(mapid)));
                    if (mapid == character.myMap.Id)
                    {
                        costo = 0;
                    }
                    sb.Append("|" + mapid + ";" + costo);
                }
            }

            return(sb.ToString());
        }
예제 #2
0
        public override string Compile()
        {
            StringBuilder sb  = new StringBuilder("WC");
            String        map = character.myMap.Id + "";

            try
            {
                map = character.SavePos.Split(',')[0];
            }
            catch (Exception localException)
            {
                Logger.Error(localException);
            }
            sb.Append(map);
            int SubAreaID = character.myMap.subArea.area.superArea.ID;

            foreach (short i in character.Zaaps)
            {
                if (MapTable.Get(i) == null || MapTable.Get(i).subArea.area.superArea.ID != SubAreaID)
                {
                    continue;
                }
                int cost = ZaapTable.calculZaapCost(character.myMap, MapTable.Get(i));
                if (i == character.myMap.Id)
                {
                    cost = 0;
                }
                sb.Append("|").Append(i).Append(";").Append(cost);
            }
            return(sb.ToString());
        }
예제 #3
0
        public static void Initialize()
        {
            nextPlayerGuid = CharacterTable.getNextGuid();
            nextPlayerGuid++;
            nextItemGuid = InventoryItemTable.getNextGuid();
            nextItemGuid++;
            nextGuildId = GuildTable.getNextGuid();
            nextGuildId++;
            nextMountId = MountTable.getNextGuid();
            nextMountId++;
            nextSpeakingId = SpeakingTable.getNextGuid();
            nextSpeakingId++;
            SpellTable.Load();
            ExpFloorTable.Load();
            MonsterTable.Load();
            ItemTemplateTable.Load();
            ItemTemplateTable.LoadItemActions();
            ItemSetTable.Load();
            DropTable.Load();
            TitleTable.Load();
            IObjectTemplateTable.Load();
            AreaTable.Load();
            AreaSubTable.Load();
            MapTable.Load();
            MapTable.LoadActions();
            CellActionTable.Load();
            MobGroupFixTable.Load();
            BreedTable.Load();
            NpcTemplateTable.Load();
            NpcTemplateTable.LoadPlaces();
            NpcQuestionTable.Load();
            NpcReplyTable.Load();
            ShopNpcTable.Initialize();
            GuildTable.Load();
            CharactersGuildTable.Load();
            TaxCollectorTable.Load();
            PrismeTable.Load();
            BidHouseTable.Load();
            BidHouseTable.LoadItems();
            MountParkTable.Load();
            StaticMountTable.Load();
            MountTable.Load();//TODO Dynamic load of Character mount
            ZaapTable.Load();
            ZaapiTable.Load();

            var Timer = new System.Timers.Timer(1000 * 60 * 25);

            Timer.Elapsed += delegate(object sender, ElapsedEventArgs e)
            {
                Save();
            };
            Timer.Start();
        }
예제 #4
0
        private static void PrismeUseRequest(WorldClient Client, string Packet)
        {
            if (Client.Character.Deshonor >= 1)
            {
                Client.Send(new TextInformationMessage(Libs.Enumerations.TextInformationTypeEnum.ERREUR, 83));
                return;
            }
            if (!Client.Character.showWings)
            {
                Client.Send(new TextInformationMessage(Libs.Enumerations.TextInformationTypeEnum.ERREUR, 144));
                return;
            }
            int   cellid = 340;
            short mapid  = 7411;

            try
            {
                mapid = short.Parse(Packet.Substring(2));
            }
            catch (Exception e) { }
            var Prism = PrismeTable.Cache.Values.First(x => x.Mapid == mapid);

            if (Prism != null)
            {
                mapid  = Prism.Mapid;
                cellid = Prism.CellId;
            }
            int prix = ZaapTable.calculZaapCost(Client.Character.myMap, MapTable.Get(mapid));

            if (mapid == Client.Character.Map)
            {
                prix = 0;
            }
            if (Client.Character.Kamas < prix)
            {
                Client.Send(new TextInformationMessage(Libs.Enumerations.TextInformationTypeEnum.ERREUR, 82));
                return;
            }
            Client.Character.InventoryCache.SubstractKamas(prix);
            Client.Character.Send(new AccountStatsMessage(Client.Character));
            Client.Character.Teleport(MapTable.Get(mapid), cellid);
            Client.Send(new PrismeMenuCloseMessage());
            Client.Character.isZaaping = false;
        }
예제 #5
0
        public static void WayPointUseRequest(WorldClient Client, String Packet)
        {
            short id = -1;

            if (!short.TryParse(Packet.Substring(2), out id) || id == -1)
            {
                Client.Send(new BasicNoOperationMessage());
                return;
            }
            if (Client.GetFight() != null)
            {
                Client.Send(new BasicNoOperationMessage());
                return;
            }
            if (!Client.Character.isZaaping)
            {
                Client.Send(new BasicNoOperationMessage());
                return;
            }
            if (!Client.Character.Zaaps.Contains(id))
            {
                Client.Send(new BasicNoOperationMessage());
                return;
            }

            if (Client.IsGameAction(GameActionTypeEnum.MAP_MOVEMENT))
            {
                Client.EndGameAction(GameActionTypeEnum.MAP_MOVEMENT);
            }
            if (Client.IsGameAction(GameActionTypeEnum.CELL_ACTION))
            {
                Client.EndGameAction(GameActionTypeEnum.CELL_ACTION);
            }
            int cost = ZaapTable.calculZaapCost(Client.GetCharacter().myMap, MapTable.Get(id));

            if (Client.Character.Kamas < cost)
            {
                Client.Send(new BasicNoOperationMessage());
                return;
            }
            //int SubAreaID = _curCarte.getSubArea().get_area().get_superArea().get_id();
            int SubAreaID = Client.Character.myMap.subArea.area.superArea.ID;

            if (MapTable.Get(id) == null)
            {
                Logger.Error("La map " + id + " n'est pas implantee, Zaap refuse");
                Client.Send(new WayPointUseMessage());
                return;
            }
            else
            {
                if (!MapTable.Get(id).myInitialized)
                {
                    MapTable.Get(id).Init();
                }
            }
            int cellID = ZaapTable.GetCell(id);

            if (MapTable.Get(id).getCell(cellID) == null)
            {
                Logger.Error("La cellule associee au zaap " + id + " n'est pas implantee, Zaap refuse");
                Client.Send(new WayPointUseMessage());
                return;
            }
            if (!MapTable.Get(id).getCell(cellID).isWalkable(true))
            {
                Logger.Error("La cellule associee au zaap " + id + " n'est pas acessible, Zaap refuse");
                Client.Send(new WayPointUseMessage());
                return;
            }
            if (MapTable.Get(id).subArea.area.superArea.ID != SubAreaID)
            {
                Client.Send(new WayPointUseMessage());
                return;
            }
            Client.Character.myMap.SendToMap(new MapAnimOffFightMessage(Client.Character.ID, 505));
            Client.Character.InventoryCache.SubstractKamas(cost);
            Client.Send(new AccountStatsMessage(Client.Character));
            Client.Send(new WayPointValideMessage());
            Client.Character.Teleport(MapTable.Get(id), cellID);
            Client.Character.myMap.SendToMap(new MapAnimOffFightMessage(Client.Character.ID, 505));
            Client.Character.isZaaping = false;
            Client.DelGameAction(GameActionTypeEnum.CELL_ACTION);
        }