Example #1
0
        public override string Compile()
        {
            String packet = "Rp" + mountPark.get_owner() + ";" + mountPark.get_price() + ";" + mountPark.get_size() + ";" + mountPark.getObjectNumb() + ";";

            Guild G = mountPark.get_guild();

            //Si une guilde est definie
            if (G != null)
            {
                packet += G.Name + ";" + G.Emblem;
            }
            else
            {
                packet += ";";
            }
            return(packet);
        }
Example #2
0
 public static void Update(MountPark model)
 {
     try
     {
         MySqlCommand Command = new MySqlCommand()
         {
             Connection  = DatabaseManager.Provider.getConnection(),
             CommandText = "REPLACE INTO `mountpark_data` VALUES(@map,@cell,@size,@owner,@guild,@price,@data);",
         };
         Command.Prepare();
         Command.Parameters.AddWithValue("@map", model.get_map().Id);
         Command.Parameters.AddWithValue("@cell", model.get_cellid());
         Command.Parameters.AddWithValue("@size", model.get_size());
         Command.Parameters.AddWithValue("@owner", model.get_owner());
         Command.Parameters.AddWithValue("@guild", (model.get_guild() == null ? -1 : model.get_guild().ID));
         Command.Parameters.AddWithValue("@price", model.get_price());
         Command.Parameters.AddWithValue("@data", (model.parseData()));
         Command.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         Logger.Error("Can't execute query : " + e.ToString());
     }
 }
Example #3
0
        private static void BuyRequest(WorldClient Client, string Packet)
        {
            Client.Send(new GameRideMessage("v"));
            MountPark MP = Client.Character.myMap.mountPark;

            if (MP == null)
            {
                Client.Send(new BasicNoOperationMessage());
                return;
            }
            if (MP.get_owner() == -1)
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 96));
                return;
            }
            if (MP.get_price() == 0)
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 97));
                return;
            }
            if (!Client.Character.HasGuild())
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 135));
                return;
            }
            if (Client.GetCharacter().getCharacterGuild().GradeType != GuildGradeEnum.GRADE_BOSS)
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 98));
                return;
            }
            byte enclosMax       = (byte)Math.Floor((double)Client.Character.GetGuild().Level / 10);
            byte TotalEncloGuild = (byte)MountParkTable.CountByGuild(Client.Character.GetGuild().ID);

            if (TotalEncloGuild >= enclosMax)
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 103));
                return;
            }
            if (Client.Character.Kamas < MP.get_price())
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 82));
                return;
            }
            Client.GetCharacter().InventoryCache.SubstractKamas(MP.get_price());
            if (MP.get_owner() > 0)
            {
                var Owner = CharacterTable.GetCharacter(MP.get_owner());
                if (Owner != null && Owner.Account.curPlayer != null)
                {
                    Owner.Send(new ChatGameMessage("Un enclo a ete vendu a " + MP.get_price() + ".", "CC0000"));
                    Owner.Account.Data.BankKamas += MP.get_price();
                    Owner.Account.Data.Save();
                }
                else
                {
                    AccountDataTable.Update(MP.get_price(), MP.get_owner());
                }
            }
            MP.set_price(0);
            MP.set_owner(Client.Character.ID);
            MP.set_guild(Client.Character.GetGuild());
            MountParkTable.Update(MP);
            CharacterTable.Update(Client.Character);
            Client.GetCharacter().myMap.SendToMap(new MapMountParkMessage(MP));
        }
Example #4
0
        public void startAction(Player perso, MiniGameAction GA)
        {
            if (GA == null)
            {
                return;
            }
            int   actionID = -1;
            short CcellID  = -1;

            try
            {
                actionID = int.Parse(GA._args.Split(';')[1]);
                CcellID  = short.Parse(GA._args.Split(';')[0]);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
            if (actionID == -1)
            {
                return;
            }
            //Verif JobAction ?
            switch ((MiniGameActionEnum)actionID)
            {
            case MiniGameActionEnum.SAVE_POS:
                String str = this.Map + "," + this.Id;
                perso.SavePos = str;
                perso.Client.Send(new TextInformationMessage(TextInformationTypeEnum.INFO, 6));
                break;

            case MiniGameActionEnum.USE_ZAAP:
                perso.openZaapMenu();
                perso.GetClient().miniActions.Remove(GA._id);
                break;

            case MiniGameActionEnum.USE_ZAAPI:
                perso.openZaapiMenu();
                perso.GetClient().miniActions.Remove(GA._id);
                break;

            case MiniGameActionEnum.PUISER:
                if (!Object.isInteractive())
                {
                    perso.GetClient().Send(new BasicNoOperationMessage());
                    return;
                }
                if (Object.getState() != (int)IObjectEnum.STATE_FULL)
                {
                    perso.GetClient().Send(new BasicNoOperationMessage());
                    return;    //Si le puits est vide
                }
                Object.setState((int)IObjectEnum.STATE_EMPTYING);
                Object.setInteractive(false);
                perso.myMap.SendToMap(new MapGameActionMessage(GA._id, 501, perso.ID + "", this.Id + "," + Object.getUseDuration() + "," + Object.getUnknowValue()));
                perso.myMap.SendToMap(new GameMapObjectMessage(perso.myMap));
                break;

            case MiniGameActionEnum.RETURN_TO_INCARNAM:
                if (perso.Level > 15)
                {
                    perso.Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 127));
                    perso.GetClient().miniActions.Remove(GA._id);
                    return;
                }
                //TODO Map By Perso
                perso.Teleport(MapTable.Get(10298), 314);
                perso.GetClient().miniActions.Remove(GA._id);
                break;

            case MiniGameActionEnum.ACCESS_TO_MOUNTPARK:
                if (Object.getState() != (int)IObjectEnum.STATE_EMPTY)
                {
                    ;
                }
                if (perso.Deshonor >= 5)
                {
                    perso.Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 83));
                    perso.GetClient().miniActions.Remove(GA._id);
                    return;
                }
                perso.inMountPark = perso.myMap.mountPark;
                perso.isAaway     = true;
                perso.Send(new GameActionEnvironementMessage(16, perso.GetClient().Account.parseDragoList()));
                break;

            case MiniGameActionEnum.BUY_MOUNTPARK:
                MountPark MP = perso.myMap.mountPark;
                if (MP.get_owner() == -1)    //Public
                {
                    perso.Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 96));
                    return;
                }
                if (MP.get_price() == 0)                        //Non en vente
                {
                    perso.Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 97));
                    return;
                }
                if (!perso.HasGuild())                        //Pas de guilde
                {
                    perso.Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 135));
                    return;
                }
                if (perso.getCharacterGuild().Grade != 1)                        //Non meneur
                {
                    perso.Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 98));
                    return;
                }
                perso.Send(new GameRideMessage("D" + MP.get_price() + "|" + MP.get_price()));
                break;

            case MiniGameActionEnum.SELL_MOUNTPARK:
            case MiniGameActionEnum.SET_MOUNTPARK_PRICE:
                MountPark MP1 = perso.myMap.mountPark;
                if (MP1 == null)
                {
                    return;
                }
                if (MP1.get_owner() == -1)    //Public
                {
                    perso.Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 94));
                    return;
                }
                if (MP1.get_owner() != perso.ID)
                {
                    perso.Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 95));
                    return;
                }
                perso.Send(new GameRideMessage("D" + MP1.get_price() + "|" + MP1.get_price()));
                break;

            default:
                Logger.Error("Case.startAction non definie pour l'actionID = " + actionID);
                break;
            }
        }