Rochet2

Portal Master convert to C++ for Trinitycore

Oct 29th, 2011
1,010
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 15.21 KB | None | 0 0
  1. /*
  2. Portal Master convert to C++ for Trinitycore
  3. By Rochet2
  4.  
  5. Credits:
  6. Rochet2
  7. Eric
  8.  
  9. ScriptName: TeLe_gossip_codebox
  10. */
  11.  
  12. #include "ScriptPCH.h"
  13.  
  14. // Teleport data
  15.  
  16. struct Eric
  17. {
  18.     uint32 menu_id, next_menu_id;
  19.     uint8 icon;
  20.     std::string name;
  21.     uint32 cost;
  22.     uint8 level, faction; // 0 Both, 1 Horde, 2 Ally
  23.     uint32 map;
  24.     float x, y, z, o;
  25. };
  26. typedef struct Eric Rochet2;
  27.  
  28. //  {menu_id, next_menu_id, icon, name, cost, level, faction, map, x, y, z, o}
  29. Rochet2 TeLe [] = // key = i & Key
  30. {
  31.     {1, 0,  2,  "Stormwind",    1,  0,  2,  0,  -8842.09f,  626.358f,   94.0867f,   3.61363f},
  32.     {1, 0,  2,  "Orgrimmar",    0,  0,  1,  1,  1601.08f,   -4378.69f,  9.9846f,    2.14362f},
  33.     {1, 0,  2,  "Darnassus",    0,  0,  2,  1,  9869.91f,   2493.58f,   1315.88f,   2.78897f},
  34.     {1, 0,  2,  "Ironforge",    0,  0,  2,  0,  -4900.47f,  -962.585f,  501.455f,   5.40538f},
  35.     {1, 0,  2,  "Exodar",   0,  0,  2,  530,    -3864.92f,  -11643.7f,  -137.644f,  5.50862f},
  36.     {1, 0,  2,  "Thunder bluff",    0,  0,  1,  1,  -1274.45f,  71.8601f,   128.159f,   2.80623f},
  37.     {1, 0,  2,  "Undercity",    0,  0,  1,  0,  1633.75f,   240.167f,   -43.1034f,  6.26128f},
  38.     {1, 0,  2,  "Silvermoon city",  0,  0,  1,  530,    9738.28f,   -7454.19f,  13.5605f,   0.043914f},
  39.     {1, 0,  2,  "Dalaran",  0,  67, 0,  571,    5809.55f,   503.975f,   657.526f,   2.38338f},
  40.     {1, 0,  2,  "Shattrath",    0,  57, 0,  530,    -1887.62f,  5359.09f,   -12.4279f,  4.40435f},
  41.     {1, 0,  2,  "Booty bay",    0,  30, 0,  0,  -14281.9f,  552.564f,   8.90422f,   0.860144f},
  42.     {1, 0,  2,  "Gurubashi arena",  0,  30, 0,  0,  -13181.8f,  339.356f,   42.9805f,   1.18013f},
  43.     {1, 6,  3,  "Eastern Kingdoms", 0,  0,  0,  0,  0,  0,  0,  0},
  44.     {1, 7,  3,  "Kalimdor", 0,  0,  0,  0,  0,  0,  0,  0},
  45.     {1, 8,  3,  "Outland",  0,  58, 0,  0,  0,  0,  0,  0},
  46.     {1, 9,  3,  "Northrend",    0,  68, 0,  0,  0,  0,  0,  0},
  47.     {1, 2,  9,  "Classic Dungeons", 0,  15, 0,  0,  0,  0,  0,  0},
  48.     {1, 3,  9,  "BC Dungeons",  0,  59, 0,  0,  0,  0,  0,  0},
  49.     {1, 4,  9,  "Wrath Dungeons",   0,  69, 0,  0,  0,  0,  0,  0},
  50.     {1, 5,  9,  "Raid Teleports",   0,  57, 0,  0,  0,  0,  0,  0},
  51.  
  52.     {2, 0,  2,  "Gnomeregan",   0,  25, 2,  0,  -5163.54f,  925.423f,   257.181f,   1.57423f},
  53.     {2, 0,  2,  "The Deadmines",    0,  17, 2,  0,  -11209.6f,  1666.54f,   24.6974f,   1.42053f},
  54.     {2, 0,  2,  "The Stockade", 0,  22, 2,  0,  -8799.15f,  832.718f,   97.6348f,   6.04085f},
  55.     {2, 0,  2,  "Ragefire Chasm",   0,  15, 1,  1,  1811.78f,   -4410.5f,   -18.4704f,  5.20165f},
  56.     {2, 0,  2,  "Razorfen Downs",   0,  34, 1,  1,  -4657.3f,   -2519.35f,  81.0529f,   4.54808f},
  57.     {2, 0,  2,  "Razorfen Kraul",   0,  24, 1,  1,  -4470.28f,  -1677.77f,  81.3925f,   1.16302f},
  58.     {2, 0,  2,  "Scarlet Monastery",    0,  32, 1,  0,  2873.15f,   -764.523f,  160.332f,   5.10447f},
  59.     {2, 0,  2,  "Shadowfang Keep",  0,  18, 1,  0,  -234.675f,  1561.63f,   76.8921f,   1.24031f},
  60.     {2, 0,  2,  "Wailing Caverns",  0,  17, 1,  1,  -731.607f,  -2218.39f,  17.0281f,   2.78486f},
  61.     {2, 0,  2,  "Blackfathom Deeps",    0,  21, 0,  1,  4249.99f,   740.102f,   -25.671f,   1.34062f},
  62.     {2, 0,  2,  "Blackrock Depths", 0,  53, 0,  0,  -7179.34f,  -921.212f,  165.821f,   5.09599f},
  63.     {2, 0,  2,  "Blackrock Spire",  0,  57, 0,  0,  -7527.05f,  -1226.77f,  285.732f,   5.29626f},
  64.     {2, 0,  2,  "Dire Maul",    0,  55, 0,  1,  -3520.14f,  1119.38f,   161.025f,   4.70454f},
  65.     {2, 0,  2,  "Maraudon", 0,  45, 0,  1,  -1421.42f,  2907.83f,   137.415f,   1.70718f},
  66.     {2, 0,  2,  "Scholomance",  0,  55, 0,  0,  1269.64f,   -2556.21f,  93.6088f,   0.620623f},
  67.     {2, 0,  2,  "Stratholme",   0,  55, 0,  0,  3352.92f,   -3379.03f,  144.782f,   6.25978f},
  68.     {2, 0,  2,  "Sunken Temple",    0,  47, 0,  0,  -10177.9f,  -3994.9f,   -111.239f,  6.01885f},
  69.     {2, 0,  2,  "Uldaman",  0,  37, 0,  0,  -6071.37f,  -2955.16f,  209.782f,   0.015708f},
  70.     {2, 0,  2,  "Zul'Farrak",   0,  35, 0,  1,  -6801.19f,  -2893.02f,  9.00388f,   0.158639f},
  71.     {2, 1,  7,  "Back..",   0,  0,  0,  0,  0,  0,  0,  0},
  72.  
  73.     {3, 0,  2,  "Auchindoun",   0,  64, 0,  530,    -3324.49f,  4943.45f,   -101.239f,  4.63901f},
  74.     {3, 0,  2,  "Caverns of Time",  0,  66, 0,  1,  -8369.65f,  -4253.11f,  -204.272f,  -2.70526f},
  75.     {3, 0,  2,  "Coilfang Reservoir",   0,  62, 0,  530,    738.865f,   6865.77f,   -69.4659f,  6.27655f},
  76.     {3, 0,  2,  "Hellfire Citadel", 0,  59, 0,  530,    -347.29f,   3089.82f,   21.394f,    5.68114f},
  77.     {3, 0,  2,  "Magisters' Terrace",   0,  70, 0,  530,    12884.6f,   -7317.69f,  65.5023f,   4.799f},
  78.     {3, 0,  2,  "Tempest Keep", 0,  70, 0,  530,    3100.48f,   1536.49f,   190.3f, 4.62226f},
  79.     {3, 1,  7,  "Back..",   0,  0,  0,  0,  0,  0,  0,  0},
  80.  
  81.     {4, 0,  2,  "Azjol-Nerub",  0,  73, 0,  571,    3707.86f,   2150.23f,   36.76f, 3.22f},
  82.     {4, 0,  2,  "The Culling of Stratholme",    0,  79, 0,  1,  -8756.39f,  -4440.68f,  -199.489f,  4.66289f},
  83.     {4, 0,  2,  "Trial of the Champion",    0,  79, 0,  571,    8590.95f,   791.792f,   558.235f,   3.13127f},
  84.     {4, 0,  2,  "Drak'Tharon Keep", 0,  74, 0,  571,    4765.59f,   -2038.24f,  229.363f,   0.887627f},
  85.     {4, 0,  2,  "Gundrak",  0,  71, 0,  571,    6722.44f,   -4640.67f,  450.632f,   3.91123f},
  86.     {4, 0,  2,  "Icecrown Citadel Dungeons",    0,  79, 0,  571,    5643.16f,   2028.81f,   798.274f,   4.60242f},
  87.     {4, 0,  2,  "The Nexus Dungeons",   0,  71, 0,  571,    3782.89f,   6965.23f,   105.088f,   6.14194f},
  88.     {4, 0,  2,  "The Violet Hold",  0,  75, 0,  571,    5693.08f,   502.588f,   652.672f,   4.0229f},
  89.     {4, 0,  2,  "Halls of Lightning",   0,  79, 0,  571,    9136.52f,   -1311.81f,  1066.29f,   5.19113f},
  90.     {4, 0,  2,  "Halls of Stone",   0,  77, 0,  571,    8922.12f,   -1009.16f,  1039.56f,   1.57044f},
  91.     {4, 0,  2,  "Utgarde Keep", 0,  69, 0,  571,    1203.41f,   -4868.59f,  41.2486f,   0.283237f},
  92.     {4, 0,  2,  "Utgarde Pinnacle", 0,  75, 0,  571,    1267.24f,   -4857.3f,   215.764f,   3.22768f},
  93.     {4, 1,  7,  "Back..",   0,  0,  0,  0,  0,  0,  0,  0},
  94.  
  95.     {5, 0,  2,  "Black Temple", 0,  70, 0,  530,    -3649.92f,  317.469f,   35.2827f,   2.94285f},
  96.     {5, 0,  2,  "Blackwing Lair",   0,  60, 0,  229,    152.451f,   -474.881f,  116.84f,    0.001073f},
  97.     {5, 0,  2,  "Hyjal Summit", 0,  70, 0,  1,  -8177.89f,  -4181.23f,  -167.552f,  0.913338f},
  98.     {5, 0,  2,  "Serpentshrine Cavern", 0,  70, 0,  530,    797.855f,   6865.77f,   -65.4165f,  0.005938f},
  99.     {5, 0,  2,  "Trial of the Crusader",    0,  80, 0,  571,    8515.61f,   714.153f,   558.248f,   1.57753f},
  100.     {5, 0,  2,  "Gruul's Lair", 0,  70, 0,  530,    3530.06f,   5104.08f,   3.50861f,   5.51117f},
  101.     {5, 0,  2,  "Magtheridon's Lair",   0,  70, 0,  530,    -336.411f,  3130.46f,   -102.928f,  5.20322f},
  102.     {5, 0,  2,  "Icecrown Citadel", 0,  80, 0,  571,    5855.22f,   2102.03f,   635.991f,   3.57899f},
  103.     {5, 0,  2,  "Karazhan", 0,  70, 0,  0,  -11118.9f,  -2010.33f,  47.0819f,   0.649895f},
  104.     {5, 0,  2,  "Molten Core",  0,  60, 0,  230,    1126.64f,   -459.94f,   -102.535f,  3.46095f},
  105.     {5, 0,  2,  "Naxxramas",    0,  80, 0,  571,    3668.72f,   -1262.46f,  243.622f,   4.785f},
  106.     {5, 0,  2,  "Onyxia's Lair",    0,  80, 0,  1,  -4708.27f,  -3727.64f,  54.5589f,   3.72786f},
  107.     {5, 0,  2,  "Ruins of Ahn'Qiraj",   0,  60, 0,  1,  -8409.82f,  1499.06f,   27.7179f,   2.51868f},
  108.     {5, 0,  2,  "Sunwell Plateau",  0,  70, 0,  530,    12574.1f,   -6774.81f,  15.0904f,   3.13788f},
  109.     {5, 0,  2,  "The Eye",  0,  67, 0,  530,    3088.49f,   1381.57f,   184.863f,   4.61973f},
  110.     {5, 0,  2,  "Temple of Ahn'Qiraj",  0,  60, 0,  1,  -8240.09f,  1991.32f,   129.072f,   0.941603f},
  111.     {5, 0,  2,  "The Eye of Eternity",  0,  80, 0,  571,    3784.17f,   7028.84f,   161.258f,   5.79993f},
  112.     {5, 0,  2,  "The Obsidian Sanctum", 0,  80, 0,  571,    3472.43f,   264.923f,   -120.146f,  3.27923f},
  113.     {5, 0,  2,  "Ulduar",   0,  80, 0,  571,    9222.88f,   -1113.59f,  1216.12f,   6.27549f},
  114.     {5, 0,  2,  "Vault of Archavon",    0,  80, 0,  571,    5453.72f,   2840.79f,   421.28f,    0.0f},
  115.     {5, 0,  2,  "Zul'Gurub",    0,  57, 0,  0,  -11916.7f,  -1215.72f,  92.289f,    4.72454f},
  116.     {5, 0,  2,  "Zul'Aman", 0,  70, 1,  530,    6851.78f,   -7972.57f,  179.242f,   4.64691f},
  117.     {5, 1,  7,  "Back..",   0,  0,  0,  0,  0,  0,  0,  0},
  118.  
  119.     {6, 0,  2,  "Elwynn Forest",    0,  0,  2,  0,  -9449.06f,  64.8392f,   56.3581f,   3.07047f},
  120.     {6, 0,  2,  "Eversong Woods",   0,  0,  1,  530,    9024.37f,   -6682.55f,  16.8973f,   3.14131f},
  121.     {6, 0,  2,  "Dun Morogh",   0,  0,  2,  0,  -5603.76f,  -482.704f,  396.98f,    5.23499f},
  122.     {6, 0,  2,  "Tirisfal Glades",  0,  0,  1,  0,  2274.95f,   323.918f,   34.1137f,   4.24367f},
  123.     {6, 0,  2,  "Ghostlands",   0,  10, 1,  530,    7595.73f,   -6819.6f,   84.3718f,   2.56561f},
  124.     {6, 0,  2,  "Loch modan",   0,  10, 2,  0,  -5405.85f,  -2894.15f,  341.972f,   5.48238f},
  125.     {6, 0,  2,  "Silverpine Forest",    0,  10, 1,  0,  505.126f,   1504.63f,   124.808f,   1.77987f},
  126.     {6, 0,  2,  "Westfall", 0,  10, 2,  0,  -10684.9f,  1033.63f,   32.5389f,   6.07384f},
  127.     {6, 0,  2,  "Redridge mountains",   0,  15, 2,  0,  -9447.8f,   -2270.85f,  71.8224f,   0.283853f},
  128.     {6, 0,  2,  "Duskwood", 0,  18, 2,  0,  -10531.7f,  -1281.91f,  38.8647f,   1.56959f},
  129.     {6, 0,  2,  "Hillsbrad Foothills",  0,  20, 0,  0,  -385.805f,  -787.954f,  54.6655f,   1.03926f},
  130.     {6, 0,  2,  "Wetlands", 0,  20, 2,  0,  -3517.75f,  -913.401f,  8.86625f,   2.60705f},
  131.     {6, 0,  2,  "Alterac Mountains",    0,  30, 0,  0,  275.049f,   -652.044f,  130.296f,   0.502032f},
  132.     {6, 0,  2,  "Arathi Highlands", 0,  30, 0,  0,  -1581.45f,  -2704.06f,  35.4168f,   0.490373f},
  133.     {6, 0,  2,  "Stranglethorn Vale",   0,  30, 0,  0,  -11921.7f,  -59.544f,   39.7262f,   3.73574f},
  134.     {6, 0,  2,  "Badlands", 0,  35, 0,  0,  -6782.56f,  -3128.14f,  240.48f,    5.65912f},
  135.     {6, 0,  2,  "Swamp of Sorrows", 0,  35, 0,  0,  -10368.6f,  -2731.3f,   21.6537f,   5.29238f},
  136.     {6, 0,  2,  "The Hinterlands",  0,  40, 0,  0,  112.406f,   -3929.74f,  136.358f,   0.981903f},
  137.     {6, 0,  2,  "Searing Gorge",    0,  43, 0,  0,  -6686.33f,  -1198.55f,  240.027f,   0.916887f},
  138.     {6, 0,  2,  "The Blasted Lands",    0,  45, 0,  0,  -11184.7f,  -3019.31f,  7.29238f,   3.20542f},
  139.     {6, 0,  2,  "Burning Steppes",  0,  50, 0,  0,  -7979.78f,  -2105.72f,  127.919f,   5.10148f},
  140.     {6, 0,  2,  "Western Plaguelands",  0,  51, 0,  0,  1743.69f,   -1723.86f,  59.6648f,   5.23722f},
  141.     {6, 0,  2,  "Eastern Plaguelands",  0,  53, 0,  0,  2280.64f,   -5275.05f,  82.0166f,   4.7479f},
  142.     {6, 0,  2,  "Isle of Quel'Danas",   0,  70, 0,  530,    12806.5f,   -6911.11f,  41.1156f,   2.22935f},
  143.     {6, 1,  7,  "Back..",   0,  0,  0,  0,  0,  0,  0,  0},
  144.  
  145.     {7, 0,  2,  "Azuremyst Isle",   0,  0,  2,  530,    -4192.62f,  -12576.7f,  36.7598f,   1.62813f},
  146.     {7, 0,  2,  "Teldrassil",   0,  0,  2,  1,  9889.03f,   915.869f,   1307.43f,   1.9336f},
  147.     {7, 0,  2,  "Durotar",  0,  0,  1,  1,  228.978f,   -4741.87f,  10.1027f,   0.416883f},
  148.     {7, 0,  2,  "Mulgore",  0,  0,  1,  1,  -2473.87f,  -501.225f,  -9.42465f,  0.6525f},
  149.     {7, 0,  2,  "Bloodmyst Isle",   0,  15, 2,  530,    -2095.7f,   -11841.1f,  51.1557f,   6.19288f},
  150.     {7, 0,  2,  "Darkshore",    0,  10, 2,  1,  6463.25f,   683.986f,   8.92792f,   4.33534f},
  151.     {7, 0,  2,  "The Barrens",  0,  10, 1,  1,  -575.772f,  -2652.45f,  95.6384f,   0.006469f},
  152.     {7, 0,  2,  "Stonetalon Mountains", 0,  15, 0,  1,  1574.89f,   1031.57f,   137.442f,   3.8013f},
  153.     {7, 0,  2,  "Ashenvale Forest", 0,  18, 0,  1,  1919.77f,   -2169.68f,  94.6729f,   6.14177f},
  154.     {7, 0,  2,  "Thousand Needles", 0,  25, 1,  1,  -5375.53f,  -2509.2f,   -40.432f,   2.41885f},
  155.     {7, 0,  2,  "Desolace", 0,  30, 0,  1,  -656.056f,  1510.12f,   88.3746f,   3.29553f},
  156.     {7, 0,  2,  "Dustwallow Marsh", 0,  35, 0,  1,  -3350.12f,  -3064.85f,  33.0364f,   5.12666f},
  157.     {7, 0,  2,  "Feralas",  0,  40, 0,  1,  -4808.31f,  1040.51f,   103.769f,   2.90655f},
  158.     {7, 0,  2,  "Tanaris Desert",   0,  40, 0,  1,  -6940.91f,  -3725.7f,   48.9381f,   3.11174f},
  159.     {7, 0,  2,  "Azshara",  0,  45, 0,  1,  3117.12f,   -4387.97f,  91.9059f,   5.49897f},
  160.     {7, 0,  2,  "Felwood",  0,  48, 0,  1,  3898.8f,    -1283.33f,  220.519f,   6.24307f},
  161.     {7, 0,  2,  "Un'Goro Crater",   0,  48, 0,  1,  -6291.55f,  -1158.62f,  -258.138f,  0.457099f},
  162.     {7, 0,  2,  "Silithus", 0,  55, 0,  1,  -6815.25f,  730.015f,   40.9483f,   2.39066f},
  163.     {7, 0,  2,  "Winterspring", 0,  55, 0,  1,  6658.57f,   -4553.48f,  718.019f,   5.18088f},
  164.     {7, 1,  7,  "Back..",   0,  0,  0,  0,  0,  0,  0,  0},
  165.  
  166.     {8, 0,  2,  "Hellfire Peninsula",   0,  58, 0,  530,    -207.335f,  2035.92f,   96.464f,    1.59676f},
  167.     {8, 0,  2,  "Zangarmarsh",  0,  60, 0,  530,    -220.297f,  5378.58f,   23.3223f,   1.61718f},
  168.     {8, 0,  2,  "Terokkar Forest",  0,  62, 0,  530,    -2266.23f,  4244.73f,   1.47728f,   3.68426f},
  169.     {8, 0,  2,  "Nagrand",  0,  64, 0,  530,    -1610.85f,  7733.62f,   -17.2773f,  1.33522f},
  170.     {8, 0,  2,  "Blade's Edge Mountains",   0,  65, 0,  530,    2029.75f,   6232.07f,   133.495f,   1.30395f},
  171.     {8, 0,  2,  "Netherstorm",  0,  67, 0,  530,    3271.2f,    3811.61f,   143.153f,   3.44101f},
  172.     {8, 0,  2,  "Shadowmoon Valley",    0,  67, 0,  530,    -3681.01f,  2350.76f,   76.587f,    4.25995f},
  173.     {8, 1,  7,  "Back..",   0,  0,  0,  0,  0,  0,  0,  0},
  174.  
  175.     {9, 0,  2,  "Borean Tundra",    0,  68, 0,  571,    2954.24f,   5379.13f,   60.4538f,   2.55544f},
  176.     {9, 0,  2,  "Howling Fjord",    0,  68, 0,  571,    682.848f,   -3978.3f,   230.161f,   1.54207f},
  177.     {9, 0,  2,  "Dragonblight", 0,  71, 0,  571,    2678.17f,   891.826f,   4.37494f,   0.101121f},
  178.     {9, 0,  2,  "Grizzly Hills",    0,  73, 0,  571,    4017.35f,   -3403.85f,  290.0f, 5.35431f},
  179.     {9, 0,  2,  "Zul'Drak", 0,  74, 0,  571,    5560.23f,   -3211.66f,  371.709f,   5.55055f},
  180.     {9, 0,  2,  "Sholazar Basin",   0,  76, 0,  571,    5614.67f,   5818.86f,   -69.722f,   3.60807f},
  181.     {9, 0,  2,  "Crystalsong Forest",   0,  77, 0,  571,    5411.17f,   -966.37f,   167.082f,   1.57167f},
  182.     {9, 0,  2,  "Storm Peaks",  0,  77, 0,  571,    6120.46f,   -1013.89f,  408.39f,    5.12322f},
  183.     {9, 0,  2,  "Icecrown", 0,  77, 0,  571,    8323.28f,   2763.5f,    655.093f,   2.87223f},
  184.     {9, 0,  2,  "Wintergrasp",  0,  77, 0,  571,    4522.23f,   2828.01f,   389.975f,   0.215009f},
  185.     {9, 1,  7,  "Back..",   0,  0,  0,  0,  0,  0,  0,  0},
  186.  
  187. //  {10,    0,  2,  "Teleport", 0,  0,  0,  map,    xf, yf, zf, of},
  188. //  {10,    1,  7,  "Back..",   0,  0,  0,  0,  0,  0,  0,  0},
  189. };
  190.  
  191. // TextIDs from npc_text
  192. enum eEnums
  193. {
  194.     TEXT_MAIN_H     =   300000,         //Horde main menu text
  195.     TEXT_MAIN_A     =   300001,         //Alliance main menu text
  196.     TEXT_DUNGEON    =   300002,         //Dungeon teleport menu texts
  197.     TEXT_RAID       =   300003,         //Raid teleport menu text
  198.     TEXT_AREA       =   300004,         //Area teleport location menu texts
  199.    
  200.     TELEPORT_COUNT  =   sizeof TeLe/sizeof(*TeLe),
  201. };
  202.  
  203. #define ARE_YOU_SURE    "Are you sure, that you want to go to "
  204. #define ERROR_COMBAT    "|cffff0000You are in combat|r"
  205.  
  206. bool Custom_FactCheck (uint32 Fact, unsigned char Key)
  207. {
  208.     bool Show = false;
  209.     switch (TeLe[Key].faction)
  210.     {
  211.     case 0:
  212.         Show = true;
  213.         break;
  214.     case 1:
  215.         if (Fact == HORDE)
  216.             Show = true;
  217.         break;
  218.     case 2:
  219.         if (Fact == ALLIANCE)
  220.             Show = true;
  221.         break;
  222.     }
  223.     return (Show);
  224. }
  225.  
  226. uint32 Custom_GetText (unsigned int menu, Player* pPlayer)
  227. {
  228.     uint32 TEXT = TEXT_AREA;
  229.     switch (menu)
  230.     {
  231.     case 0:
  232.         switch (pPlayer->GetTeam())
  233.         {
  234.         case ALLIANCE:
  235.             TEXT = TEXT_MAIN_A;
  236.             break;
  237.         case HORDE:
  238.             TEXT = TEXT_MAIN_H;
  239.             break;
  240.         }
  241.     case 1:
  242.     case 2:
  243.     case 3:
  244.         TEXT = TEXT_DUNGEON;
  245.         break;
  246.     case 4:
  247.         TEXT = TEXT_RAID;
  248.         break;
  249.     }
  250.     return (TEXT);
  251. }
  252.  
  253. void Custom_GetMenu (Player* pPlayer, Creature* pCreature, uint32 Key)
  254. {
  255.     bool ENDMENU = false;
  256.     for(uint32 i = 0; i < TELEPORT_COUNT; i++)
  257.     {
  258.         if (ENDMENU && TeLe[i].menu_id != Key)
  259.             break;
  260.         if (TeLe[i].menu_id == Key && pPlayer->getLevel() >= TeLe[i].level && Custom_FactCheck(pPlayer->GetTeam(), i))
  261.         {
  262.             if (TeLe[i].next_menu_id != 0)
  263.                 pPlayer->ADD_GOSSIP_ITEM_EXTENDED(TeLe[i].icon, TeLe[i].name, GOSSIP_SENDER_MAIN, i, "", TeLe[i].cost, false);
  264.             else
  265.                 pPlayer->ADD_GOSSIP_ITEM_EXTENDED(TeLe[i].icon, TeLe[i].name, GOSSIP_SENDER_MAIN, i, ARE_YOU_SURE+TeLe[i].name, TeLe[i].cost, false);
  266.             ENDMENU = true;
  267.         }
  268.     }
  269.     pPlayer->PlayerTalkClass->SendGossipMenu(Custom_GetText(Key, pPlayer), pCreature->GetGUID());
  270. }
  271.  
  272. class TeLe_gossip_codebox : public CreatureScript
  273. {
  274.     public:
  275.     TeLe_gossip_codebox()
  276.     : CreatureScript("TeLe_gossip_codebox")
  277.     {
  278.     }
  279.  
  280.     bool OnGossipHello(Player* pPlayer, Creature* pCreature)
  281.     {
  282.         Custom_GetMenu(pPlayer, pCreature, 1);
  283.         return true;
  284.     }
  285.  
  286.     bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
  287.     {
  288.         pPlayer->PlayerTalkClass->ClearMenus(); // clear the menu
  289.  
  290.         pPlayer->ModifyMoney(-1 * TeLe[uiAction].cost); // take cash
  291.         uint32 Key = TeLe[uiAction].next_menu_id;
  292.         if (Key == 0) // if no next_menu_id, then teleport to coords
  293.         {
  294.             if (!pPlayer->isInCombat())
  295.             {
  296.                 pPlayer->CLOSE_GOSSIP_MENU();
  297.                 pPlayer->TeleportTo(TeLe[uiAction].map, TeLe[uiAction].x, TeLe[uiAction].y, TeLe[uiAction].z, TeLe[uiAction].o);
  298.                 return true;
  299.             }
  300.             pPlayer->GetSession()->SendAreaTriggerMessage(ERROR_COMBAT);
  301.             Key = TeLe[uiAction].menu_id;
  302.         }
  303.  
  304.         Custom_GetMenu(pPlayer, pCreature, Key);
  305.         return true;
  306.     }
  307. };
  308.  
  309. void AddSC_TeLe_gossip_codebox()
  310. {
  311.     new TeLe_gossip_codebox();
  312. }
Advertisement
Add Comment
Please, Sign In to add comment