|
Дата: Суббота, 03.09.2011, 16:13 | Сообщение # 1 |
VIP Статус: Злобный Пингвин
Группа: **V.i.P**
Сообщений: 1044
|
Code 1. diff --git a/src/game/ScriptLoader.cpp b/src/game/ScriptLoader.cpp 2. --- a/src/game/ScriptLoader.cpp 3. +++ b/src/game/ScriptLoader.cpp 4. @@ -22,6 +22,7 @@ 5. 6. #ifdef DO_SCRIPTS 7. //custom 8. +void AddSC_npc_mount(); 9. 10. //examples 11. void AddSC_example_creature(); 12. @@ -518,6 +519,7 @@ 13. #ifdef DO_SCRIPTS 14. 15. //custom 16. + AddSC_npc_mount(); 17. 18. //examples 19. AddSC_example_creature(); 20. diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt 21. --- a/src/scripts/CMakeLists.txt 22. +++ b/src/scripts/CMakeLists.txt 23. @@ -17,6 +17,7 @@ 24. ../game/ScriptedSimpleAI.cpp 25. ../game/ScriptedSimpleAI.h 26. custom/on_events.cpp 27. + custom/npc_mount.cpp 28. eastern_kingdoms/alterac_valley/alterac_valley.cpp 29. eastern_kingdoms/alterac_valley/boss_balinda.cpp 30. eastern_kingdoms/alterac_valley/boss_drekthar.cpp 31. diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj 32. --- a/win/VC90/game.vcproj 33. +++ b/win/VC90/game.vcproj 34. @@ -1685,6 +1685,10 @@ 35. RelativePath="..\..\src\scripts\custom\on_events.cpp" 36. > 3 7. < /File> 38. + <File 39. + RelativePath="..\..\sr c\sc ript s\cu stom \npc _mou nt.c pp" 4 0. + > 41. + </File> 42. </Filter> 43. <Filter 44. Name="World" 45. d iff --git a/src/scripts/custom/npc_mount.cpp b/src/scripts/custom/npc_mount.cpp 46. new file mode 100644 47. --- /dev/null 48. +++ b/src/scripts/custom/npc_mount.cpp 49. @@ -0,0 +1,74 @@ 50. +/* WORLD 51. +DELETE FROM `creature_template` WHERE `entry` = '470101'; 52. + 53. +REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `minlevel`, `maxlevel`, `armor_mod`, `faction_A`, `faction_H`, `npcflag`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `PetSpellDataId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `health_mod`, `mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES 54. +(470101, 0, 0, 0, 15609, 0, 15609, 0, 'Mounts', '', NULL, 82, 82, 1, 35, 35, 1, 1, 1000, 1500, 0, 1000, 1, 1500, 1500, 1, 2, 0, 0, 0, 0, 0, 0, 30, 45, 100, 7, 8, 0, 0, 0, 100, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, 1500, 1700, '', 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 'npc_mount'); 55. + 56. +DELETE FROM `locales_creature` WHERE `entry` = '470101'; 57. + 58. +REPLACE INTO `locales_creature` (`entry`, `name_loc8`, `subname_loc8`) VALUES 59. +(470101, 'Прокат маунтов', ''); 60. +*/ 61. +#include "ScriptedPch.h" 62. + 63. +#define MSG_GOSSIP_TEXT_1 "Я бы хотел взять на прокат быстрое средство передвижения за 10 медных монет" 64. +#define MSG_GOSSIP_TEXT_2 "Я бы хотел взять на прокат очень быстрое средство передвижения за 1 серебряную" 65. +#define MSG_NOT_MONEY "У вас не достаточно денег..." 66. +#define MSG_MOUTED "Вы уже на средстве передвижения." 67. +#define COST_MONEY_1 10 68. +#define COST_MONEY_2 100 69. +#define MOUNT_SPELL_ID_1 43899 70. +#define MOUNT_SPELL_ID_2 43900 71. + 72. +bool GossipHello_npc_mount(Player *player, Creature *_creature) 73. +{ 74. + player->ADD_GOSSIP_ITEM(0, MSG_GOSSIP_TEXT_1, GOSSIP_SENDER_MAIN, 1001); 75. + player->ADD_GOSSIP_ITEM(0, MSG_GOSSIP_TEXT_2, GOSSIP_SENDER_MAIN, 1002); 76. + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, _creature->GetGUID()); 77. + return true; 78. +} 79. + 80. +bool GossipSelect_npc_mount(Player *player, Creature *_creature, uint32 sender, uint32 action ) 81. +{ 82. + if (sender != GOSSIP_SENDER_MAIN) 83. + return false; 84. + 85. + if (player->IsMounted()){ 86. + _creature->MonsterWhisper(MSG_MOUTED, player->GetGUID()); 87. + return false; 88. + } 89. + 90. + switch (action) 91. + { 92. + case 1001: 93. + if (player->GetMoney() < COST_MONEY_1) 94. + { 95. + _creature->Mons terW hisp er(M SG_N OT_M ONEY , player->GetGUID()); 96. + }else{ 97. + player->AddAura(MOUNT_S PELL _ID_ 1, p la yer) ; 98. + player->ModifyMoney(-COST_MONEY_1); 99. + } 100. + break; 101. + case 1002: 102. + if (player->GetMoney() < COST_MONEY_2) 103. + { 104. + _creature->Mons terW hisp er(M SG_N OT_M ONEY , player->GetGUID()); 105. + }else{ 106. + player->AddAura(MOUNT_S PELL _ID_ 2, p la yer) ; 107. + player->ModifyMoney(-COST_MONEY_2); 108. + } 109. + break; 110. + } 111. + return true; 112. +} 113. + 114. + 115. +voi d AddSC_npc_mount() 116. +{ 117. + Script *newscript; 118. + newscript = new Script; 119. + newscript->Name = "npc_mount"; 120. + newscript->pGossipHello = &GossipHello_npc_mount; 121. + newscript->pGossipSelect = &GossipSelect_npc_mount; 122. + newscript->RegisterSelf(); 123. +}
| | |
|