Advertisement
Rochet2

Health setter Trinitycore

Sep 6th, 2012
909
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.33 KB | None | 0 0
  1. -- Trinity HP calculation SQL. By Rochet2
  2. -- Instructions:
  3. -- Set the NPC Entry and Health you want it to have below.
  4.  
  5. SET
  6. @NPC_ENTRY := 190010, -- This is your NPC's Entry
  7. @NPC_HEALTH := 20000; -- This is the health value you want your NPC to have.
  8.  
  9. -- DO NOT CHANGE ANYTHING BELOW, UNLESS YOU KNOW WHAT YOU ARE DOING.
  10. -- Trinity HP calculation SQL. By Rochet2
  11. -- Getting NPC datas:
  12. SET
  13. @NPC_CLASS := (SELECT `unit_class` FROM creature_template WHERE Entry = @NPC_ENTRY),
  14. @NPC_LEVEL := ROUND(((SELECT `minlevel` FROM creature_template WHERE Entry = @NPC_ENTRY)+(SELECT `maxlevel` FROM creature_template WHERE Entry = @NPC_ENTRY))/2, 0),
  15. @EXP := (SELECT `exp` FROM creature_template WHERE Entry = @NPC_ENTRY);
  16.  
  17. -- Getting base HP from a HP column defined by exp.
  18. SET
  19. @GET_HP_COL :=
  20. (SELECT CASE @EXP
  21.     WHEN 0 THEN (SELECT basehp0 FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL AND `class` = @NPC_CLASS)
  22.     WHEN 1 THEN (SELECT basehp1 FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL AND `class` = @NPC_CLASS)
  23.     WHEN 2 THEN (SELECT basehp2 FROM creature_classlevelstats WHERE `level` = @NPC_LEVEL AND `class` = @NPC_CLASS)
  24. END);
  25.  
  26. -- Running the update with all the data collected:
  27. UPDATE creature_template SET HealthModifier = (@NPC_HEALTH/@GET_HP_COL) WHERE Entry = @NPC_ENTRY;
  28. -- Trinity HP calculation SQL. By Rochet2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement