update npc,tmpnpc set npc.mdef = tmpnpc.newmdef where npc.id = tmpnpc.id and npc.mdef < tmpnpc.newmdef; ----------------------------------------------------------------- mdef drop table tmpnpc; create table tmpnpc select id,mdef,round(35.8052*exp(0.0293*level)) as newmdef from npc where level < 40 and level > 20; drop table tmpnpc; create table tmpnpc select id,mdef,round(-24.8581661+(3.4389099*level)) as newmdef from npc where level >= 40; round(35.8052*exp(0.0293*level)) as newmdef (<40) round(-24.8581661+(3.4389099*level)) as newmdef (>=40) if ($level < 40) $res = 35.8052 * exp(0.0293 * $level); else $res = -24.8581661 + 3.4389099 * $level; ----------------------------------------------------------------- matk drop table tmpnpc; create table tmpnpc select id,matk,round(7.9594*exp(0.0686*level)) as newmatk from npc where level < 40 and level > 20; drop table tmpnpc; create table tmpnpc select id,matk,round(21.58*exp(0.045*level)) as newmatk from npc where level >= 40; if ($level < 40) $res = 7.9594 * exp(0.0686 * $level); else $res = 21.58 * exp(0.045 * $level); ----------------------------------------------------------------- pdef drop table tmpnpc; create table tmpnpc select id,pdef,round(48.9335*exp(0.0293*level)) as newpdef from npc where level < 40 and level > 20; drop table tmpnpc; create table tmpnpc select id,pdef,round(67.2518*exp(0.0217*level)) as newpdef from npc where level >= 40; if ($level < 40) $res = 48.9335 * exp(0.0293 * $level); else $res = 67.2518 * exp(0.0217 * $level); ----------------------------------------------------------------- patk drop table tmpnpc; create table tmpnpc select id,patk,round(11.4903*exp(0.0692*level)) as newpatk from npc where level < 40 and level > 20; drop table tmpnpc; create table tmpnpc select id,patk,round(28.5276*exp(0.0472*level)) as newpatk from npc where level >= 40; if ($level < 40) $res = 11.4903 * exp(0.0692 * $level); else $res = 28.5276 * exp(0.0472 * $level); ----------------------------------------------------------------- mp if ($level < 40) $res = -100.62 + 14.4 * $level; else $res = -697.733333 + 29 * $level; ----------------------------------------------------------------- hp if ($level < 40) $res = 127.6828 * exp(0.0513 * $level); else $res = -1102.0639 + 50.6979 * $level;