Jump to content

naseem

Members
  • Posts

    4
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by naseem

  1. and player_levelstats

    DELIMITER $$
    
    DROP PROCEDURE IF EXISTS `sp_CharExtraLevelStats` $$
    CREATE PROCEDURE `sp_CharExtraLevelStats` ()
    BEGIN
    
     -- Declaration des constantes/maximum/limites
     DECLARE intMaxStats    INT   DEFAULT 255;
     DECLARE sngStatsInc    FLOAT DEFAULT 0.05;    -- Increment of 5% per level, adjust to whatever you like
     DECLARE intStartLvl    INT   DEFAULT 70;      -- Starting level,70 is the default
     DECLARE intFinishLvl   INT   DEFAULT 80;      -- Finishing level, 80 is the default
    
     -- Declaration des variabes de base
     DECLARE intRecordDone  INT   DEFAULT 0;
     DECLARE intRace        INT   DEFAULT 0;
     DECLARE intClass       INT   DEFAULT 0;
     DECLARE intLevel       INT   DEFAULT 0;
     DECLARE intCurrSTR     INT   DEFAULT 0;
     DECLARE intCurrAGI     INT   DEFAULT 0;
     DECLARE intCurrSTA     INT   DEFAULT 0;
     DECLARE intCurrINT     INT   DEFAULT 0;
     DECLARE intCurrSPI     INT   DEFAULT 0;
    
    
     -- Declaration des algorythme
     DECLARE curPlayerStat  CURSOR FOR SELECT `race`, `class`, `level`, `str`, `agi`, `sta`, `inte`, `spi` FROM player_levelstats;
     DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET intRecordDone = 1;
    
    
     OPEN curPlayerStat;
    
     REPEAT
    
       FETCH curPlayerStat INTO intRace, intClass, intLevel, intCurrSTR, intCurrAGI, intCurrSTA, intCurrINT, intCurrSPI;
    
       IF intLevel = intStartLvl THEN
          REPEAT
            -- Nous allons faire cela pour le lvl suivant
            SET intLevel = intLevel + 1;
            -- Delete the entry for the next level (this is so we don't have to check whether we need UPDATE or INSERT statement
            DELETE FROM player_levelstats WHERE `race` = intRace AND `class` = intClass AND `level` = intLevel;
    
            -- Calcule du suivant STR
            IF (ROUND(intCurrSTR * (1 + sngStatsInc))) <= intMaxStats THEN
              SET intCurrSTR = ROUND(intCurrSTR * (1 + sngStatsInc));
            ELSE
              SET intCurrSTR = intMaxStats;
            END IF;
            -- Calcule du suivant AGI
            IF (ROUND(intCurrAGI * (1 + sngStatsInc))) <= intMaxStats THEN
              SET intCurrAGI = ROUND(intCurrAGI * (1 + sngStatsInc));
            ELSE
              SET intCurrAGI = intMaxStats;
            END IF;
            -- Calcule du suivant STA
            IF (ROUND(intCurrSTA * (1 + sngStatsInc))) <= intMaxStats THEN
              SET intCurrSTA = ROUND(intCurrSTA * (1 + sngStatsInc));
            ELSE
              SET intCurrSTA = intMaxStats;
            END IF;
            -- Calcule du suivant INT
            IF (ROUND(intCurrINT * (1 + sngStatsInc))) <= intMaxStats THEN
              SET intCurrINT = ROUND(intCurrINT * (1 + sngStatsInc));
            ELSE
              SET intCurrINT = intMaxStats;
            END IF;
            -- Calcule du suivant SPI
            IF (ROUND(intCurrSPI * (1 + sngStatsInc))) <= intMaxStats THEN
              SET intCurrSPI = ROUND(intCurrSPI * (1 + sngStatsInc));
            ELSE
              SET intCurrSPI = intMaxStats;
            END IF;
    
            -- insertion dans la table
            INSERT INTO player_levelstats
            (`race`, `class`, `level`, `str`, `agi`, `sta`, `inte`, `spi`)
            VALUES
            (intRace, intClass, intLevel, intCurrSTR, intCurrAGI, intCurrSTA, intCurrINT, intCurrSPI);
          UNTIL intLevel = intFinishLvl END REPEAT;
       END IF;
     UNTIL intRecordDone END REPEAT;
    
     -- on ferme l'algorythme
     CLOSE curPlayerStat;
    
    END $$
    
    DELIMITER ;
    call sp_CharExtraLevelStats();

    I'm having trouble executing this script inside the DB i get Root access problem xD is there away around this problem?

  2. thank u for the help! but when i try to execute the script i get this error

    (0 row(s) affected, 1 warning(s))

    Execution Time : 00:00:00:000

    Transfer Time : 00:00:00:000

    Total Time : 00:00:00:000

    Error Code : 1044

    Access denied for user 'root'@'%' to database 'mangos'

    Execution Time : 00:00:00:000

    Transfer Time : 00:00:00:000

    Total Time : 00:00:00:000

    Error Code : 1305

    PROCEDURE mangos.sp_CharExtraclassLevelStats does not exist

    Execution Time : 00:00:00:000

    Transfer Time : 00:00:00:000

    Total Time : 00:00:00:000

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use