mangosR2/mangos — Issue #460: adding 255 pet levelstats crash
Author: marx123
Created: 2011-10-28 04:46:26+00:00
State: open

added 255 pet levelstats with this
mindmg and max dmg will be 0 ( iwill make them manually) but i get crash if i try to run the server with 255 pet levelstats
so it there some mistake what i did or is there some limitation in core that cant have 255 pet levelstst?
or mabye need to modify the script that it will add min and max dmg and attackpower?
thanks

BEGIN

-- Declaration des constantes/maximum/limites
DECLARE intMaxHP INT DEFAULT 65535;
DECLARE intMaxMana INT DEFAULT 65535;
DECLARE intMaxArmor INT DEFAULT 65535;
DECLARE intMaxStats INT DEFAULT 400;
DECLARE sngHPInc FLOAT DEFAULT 0.05; -- Increment of 5% per level, adjust to whatever you like
DECLARE sngManaInc FLOAT DEFAULT 0.05; -- Increment of 5% per level, adjust to whatever you like
DECLARE sngArmorInc FLOAT DEFAULT 0.05; -- Increment of 5% per level, adjust to whatever you like
DECLARE sngStatsInc FLOAT DEFAULT 0.05; -- Increment of 5% per level, adjust to whatever you like
DECLARE intStartLvl INT DEFAULT 1; -- Starting level,70 is the default
DECLARE intFinishLvl INT DEFAULT 255; -- Finishing level, 80 is the default

-- Declaration des variables de base
DECLARE intRecordDone INT DEFAULT 0;
DECLARE intCreature INT DEFAULT 0;
DECLARE intLevel INT DEFAULT 0;
DECLARE intClass INT DEFAULT 0;
DECLARE intCurrHP INT DEFAULT 0;
DECLARE intCurrMana INT DEFAULT 0;
DECLARE intCurrArmor 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 de l'algorythme
DECLARE curPetStat CURSOR FOR SELECT `creature_entry`, `level`, `hp`, `mana`, `armor`, `str`, `agi`, `sta`, `inte`, `spi` FROM pet_levelstats;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET intRecordDone = 1;

OPEN curPetStat;

REPEAT

FETCH curPetStat INTO intCreature, intLevel, intCurrHP, intCurrMana, intCurrArmor, intCurrSTR, intCurrAGI, intCurrSTA, intCurrINT, intCurrSPI;

IF intLevel = intStartLvl THEN
REPEAT
-- ce que nous allons faire 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 pet_levelstats WHERE `creature_entry` = intCreature AND `level` = intLevel;

-- Calcule du suivant H{
IF (ROUND(intCurrHP * (1 + sngHPInc))) <= intMaxHP THEN
SET intCurrHP = ROUND(intCurrHP * (1 + sngHPInc));
ELSE
SET intCurrHP = intMaxHP; -- Making sure we don't exceed the database limit
END IF;
-- Calcule des Mana suivant
IF (ROUND(intCurrMana * (1 + sngManaInc))) <= intMaxMana THEN
SET intCurrMana = ROUND(intCurrMana * (1 + sngManaInc));
ELSE
SET intCurrMana = intMaxMana;
END IF;
-- Calcule de l'armure suivant
IF (ROUND(intCurrArmor * (1 + sngArmorInc))) <= intMaxArmor THEN
SET intCurrArmor = ROUND(intCurrArmor * (1 + sngArmorInc));
ELSE
SET intCurrArmor = intMaxArmor;
END IF;
-- 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 pet_levelstats
(`creature_entry`, `level`, `hp`, `mana`, `armor`, `str`, `agi`, `sta`, `inte`, `spi`)
VALUES
(intCreature, intLevel, intCurrHP, intCurrMana, intCurrArmor, intCurrSTR, intCurrAGI, intCurrSTA, intCurrINT, intCurrSPI);
UNTIL intLevel = intFinishLvl END REPEAT;
END IF;
UNTIL intRecordDone END REPEAT;

-- on ferme l'algorythme
CLOSE curPetStat;