Advertisement
Breezicreaf

Gamble NPC in SQL

Dec 15th, 2012
1,311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 4.67 KB | None | 0 0
  1. /*Done and coded by Breezicreaf*/
  2.  
  3. SET @NpcID :='X'; -- ID of npc HERE
  4. SET @GossipID :='X'; -- Gossip ID here
  5. SET @ItemID1 :='X'; -- Item you can win when you gamble for 5 Tokens
  6. SET @ItemID2 :='X'; -- Item you can win when you gamble for 10 Tokens
  7. SET @ItemID3 :='X'; -- Item you can win when you gamble for 25 Tokens
  8. SET @ItemID4 :='X'; -- Item you can win when you gamble for 50 Tokens
  9. SET @ItemID5 :='X'; -- Item you can win when you gamble for 100 Tokens
  10. SET @Chance :='X'; -- The chance of winning an item between 1 and 100
  11.  
  12. /*Don't EDIT below this part, unless you want to change the amount and name of the items*/
  13.  
  14. DELETE FROM creature_template WHERE entry =@NpcID;
  15.  
  16. INSERT INTO creature_template (entry, modelid1, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, Health_mod, Mana_mod, Armor_mod, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, dmg_multiplier, unit_class, unit_flags, TYPE, type_flags, InhabitType, RegenHealth, flags_extra, AiName) VALUES
  17. (@NpcID, '21572', "Stein Bagger", "Gamble Npc", NULL, @GossipID, 71, 71, 1.56, 1.56, 1.56, 1161, 1161, 3, 1, 1.14286, 1.25, 1, 1, 1, 2, 7, 138936390, 3, 1, 2, 'SmartAI');
  18.  
  19. DELETE FROM gossip_menu_option WHERE menu_id =@GossipID;
  20.  
  21. INSERT INTO gossip_menu_option (menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, action_menu_id, action_poi_id, box_coded, box_money, box_text) VALUES
  22. (@GossipID, 0, 10, '|CFFFFFFFF---------|r|CFF003333[Stein Begger]|r|CFFFFFFFF---------|r', 1, 1, 0, 0, 0, 0, NULL),
  23. (@GossipID, 1, 10, '|CFF003333Gamble|r|CFFFFFFFF:|r 5 Gamble Tokens', 1, 1, 0, 0, 0, 0, 'Are you sure you want to gamble?'),
  24. (@GossipID, 2, 10, '|CFF003333Gamble|r|CFFFFFFFF:|r 10 Gamble Tokens', 1, 1, 0, 0, 0, 0, 'Are you sure you want to gamble?'),
  25. (@GossipID, 3, 10, '|CFF003333Gamble|r|CFFFFFFFF:|r 25 Gamble Tokens', 1, 1, 0, 0, 0, 0, 'Are you sure you want to gamble?'),
  26. (@GossipID, 4, 10, '|CFF003333Gamble|r|CFFFFFFFF:|r 50 Gamble Tokens', 1, 1, 0, 0, 0, 0, 'Are you sure you want to gamble?'),
  27. (@GossipID, 5, 10, '|CFF003333Gamble|r|CFFFFFFFF:|r 100 Gamble Tokens', 1, 1, 0, 0, 0, 0, 'Are you sure you want to gamble?'),
  28. (@GossipID, 6, 10, '|CFF003333Gamble Npc|r|CFFFFFFFF:|r Hello i`m your local gamble npc. To watch my gamble offers you will need the required amount of tokens. I gamble with 5 tokens, 10 tokens, 25 tokens, 50 tokens, and, 100 tokens!', 1, 1, 0, 0, 0, 0, NULL);
  29.  
  30. /*SmartAI to add item if won, and remove item that has been gambled*/
  31.  
  32. DELETE FROM smart_scripts WHERE entryorguid =@NpcID;
  33.  
  34. INSERT INTO smart_scripts (entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o, comment) VALUES
  35. (@NpcID, 0, 1, 1, 62, 0, @Chance, 0, @GossipID, 1, 0, 0, 56, @ItemID1, 10, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Gamble 5 Tokens'),
  36. (@NpcID, 0, 2, 1, 62, 0, @Chance, 0, @GossipID, 2, 0, 0, 56, @ItemID2, 20, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Gamble 10 Tokens'),
  37. (@NpcID, 0, 3, 1, 62, 0, @Chance, 0, @GossipID, 3, 0, 0, 56, @ItemID3, 50, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Gamble 25 Tokens'),
  38. (@NpcID, 0, 4, 1, 62, 0, @Chance, 0, @GossipID, 4, 0, 0, 56, @ItemID4, 100, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Gamble 50 Tokens'),
  39. (@NpcID, 0, 5, 1, 62, 0, @Chance, 0, @GossipID, 5, 0, 0, 56, @ItemID5, 200, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Gamble 100 Tokens'),
  40. (@NpcID, 0, 6, 0, 62, 0, 100, 0, @GossipID, 1, 0, 0, 57, @ItemID1, 5, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Remove 5 Tokens'),
  41. (@NpcID, 0, 7, 0, 62, 0, 100, 0, @GossipID, 2, 0, 0, 57, @ItemID2, 10, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Remove 10 Tokens'),
  42. (@NpcID, 0, 8, 0, 62, 0, 100, 0, @GossipID, 3, 0, 0, 57, @ItemID3, 25, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Remove 25 Tokens'),
  43. (@NpcID, 0, 9, 0, 62, 0, 100, 0, @GossipID, 4, 0, 0, 57, @ItemID4, 50, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Remove 50 Tokens'),
  44. (@NpcID, 0, 10, 0, 62, 0, 100, 0, @GossipID, 5, 0, 0, 57, @ItemID5, 100, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Remove 100 Tokens');
  45.  
  46. /*Conditions to make sure you can't cheat*/
  47.  
  48. DELETE FROM conditions WHERE SourceGroup =@GossipID;
  49.  
  50. INSERT INTO conditions (SourceTypeOrReferenceId, SourceGroup, SourceEntry, ConditionTypeOrReference, ConditionValue1, ConditionValue2, Comment) VALUES
  51. (15, @GossipID, 1, 2, @ItemID1, 5, '5 Token'),
  52. (15, @GossipID, 2, 2, @ItemID2, 10, '10 Token'),
  53. (15, @GossipID, 3, 2, @ItemID1, 25, '25 Token'),
  54. (15, @GossipID, 4, 2, @ItemID2, 50, '50 Token'),
  55. (15, @GossipID, 5, 2, @ItemID1, 100, '100 Token');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement