关灯
开启左侧

Mangos2.4.3版本从NPC处获得技能BUFF的C++脚本

  [复制链接]
admin实名认证 发表于 2016-4-20 22:47:16 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
 
diff -Nuar oregoncore-current/sql/CMakeLists.txt oregoncore-pq/sql/CMakeLists.txt--- oregoncore-current/sql/CMakeLists.txt        2011-01-01 10:03:07.000000000 -0500
+++ oregoncore-pq/sql/CMakeLists.txt        2011-01-01 10:10:24.000000000 -0500
@@ -1,6 +1,7 @@
add_subdirectory(updates)
add_subdirectory(tools)
add_subdirectory(scripts)
+add_subdirectory(oc-patch)


########### install files ###############
diff -Nuar oregoncore-current/sql/oc-patch/CMakeLists.txt oregoncore-pq/sql/oc-patch/CMakeLists.txt
--- oregoncore-current/sql/oc-patch/CMakeLists.txt        1969-12-31 19:00:00.000000000 -0500
+++ oregoncore-pq/sql/oc-patch/CMakeLists.txt        2011-01-01 10:10:24.000000000 -0500
@@ -0,0 +1,6 @@
+
+########### install files ###############
+
+FILE(GLOB _SQL *.sql)
+
+install(FILES ${_SQL} DESTINATION share/oregon/sql/oc-patch)
diff -Nuar oregoncore-current/sql/oc-patch/world-buffhealnpc.sql oregoncore-pq/sql/oc-patch/world-buffhealnpc.sql
--- oregoncore-current/sql/oc-patch/world-buffhealnpc.sql        1969-12-31 19:00:00.000000000 -0500
+++ oregoncore-pq/sql/oc-patch/world-buffhealnpc.sql        2011-01-01 10:10:24.000000000 -0500
@@ -0,0 +1,9 @@
+--
+-- Dumping data for table `creature_template`
+--
+
+INSERT INTO `creature_template` (`entry`, `heroic_entry`, `modelid_A`, `modelid_A2`, `modelid_H`, `modelid_H2`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, `minmana`, `maxmana`, `armor`, `faction_A`, `faction_H`, `npcflag`, `speed`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `baseattacktime`, `rangeattacktime`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `class`, `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`, `RacialLeader`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES
+(91000, 0, 3348, 0, 3348, 0, 'Alaresque', 'Supreme Mage', NULL, 0, 80, 80, 25000, 25000, 100000, 100000, 10000, 35, 35, 1, 1, 1, 1, 1763, 1763, 0, 1511, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'EventAI', 0, 3, 0, 1, 0, 0, 0, 'npc_buff'),
+(91001, 0, 3486, 0, 3486, 0, 'Florana Nightingly', 'The Crimson Cross', NULL, 0, 80, 80, 25000, 25000, 100000, 100000, 10000, 35, 35, 1, 1, 1, 1, 1763, 1763, 0, 1511, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'EventAI', 0, 3, 0, 1, 0, 0, 0, 'npc_heal'),
+(91002, 0, 10746, 0, 10746, 0, 'Flo Nizzengale', 'The Crimson Cross', NULL, 0, 80, 80, 25000, 25000, 100000, 100000, 10000, 35, 35, 1, 1, 1, 1, 1763, 1763, 0, 1511, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'EventAI', 0, 3, 0, 1, 0, 0, 0, 'npc_heal');
+
diff -Nuar oregoncore-current/src/game/ScriptLoader.cpp oregoncore-pq/src/game/ScriptLoader.cpp
--- oregoncore-current/src/game/ScriptLoader.cpp        2011-01-01 10:03:08.000000000 -0500
+++ oregoncore-pq/src/game/ScriptLoader.cpp        2011-01-01 10:10:24.000000000 -0500
@@ -11,6 +11,10 @@

#ifdef SCRIPTS

+//custom
+void AddSC_npc_buff();
+void AddSC_npc_heal();
+
//examples
//void AddSC_custom_example();
//void AddSC_custom_gossip_codebox();
@@ -379,6 +383,11 @@
void AddScripts()
{
#ifdef SCRIPTS
+
+    //Custom
+    AddSC_npc_buff();
+    AddSC_npc_heal();
+
//    AddSC_custom_example();
//    AddSC_custom_gossip_codebox();
//    AddSC_test();
diff -Nuar oregoncore-current/src/scripts/Custom/npc_buff.cpp oregoncore-pq/src/scripts/Custom/npc_buff.cpp
--- oregoncore-current/src/scripts/Custom/npc_buff.cpp        1969-12-31 19:00:00.000000000 -0500
+++ oregoncore-pq/src/scripts/Custom/npc_buff.cpp        2011-01-01 10:10:24.000000000 -0500
@@ -0,0 +1,254 @@
+/* ScriptData
+SDName: NPC_Buff
+SD%Complete: 95
+SDComment: Buff Master
+SDCategory: NPC
+EndScriptData */
+
+#include "ScriptPCH.h"
+
+bool GossipHello_NPC_Buff(Player *player, Creature *_Creature)
+{
+    // Main Menu for Alliance
+    if ( player->GetTeam() == ALLIANCE )
+    {
+        player->ADD_GOSSIP_ITEM( 7, "Small Spells ->", GOSSIP_SENDER_MAIN, 1000);
+        player->ADD_GOSSIP_ITEM( 7, "GM Spells ->", GOSSIP_SENDER_MAIN, 3000);
+        player->ADD_GOSSIP_ITEM( 7, "Other Gifts ->", GOSSIP_SENDER_MAIN, 4000);
+    }
+    else // Main Menu for Horde
+    {
+        player->ADD_GOSSIP_ITEM( 7, "Small Spells ->", GOSSIP_SENDER_MAIN, 1000);
+        player->ADD_GOSSIP_ITEM( 7, "GM Spells ->", GOSSIP_SENDER_MAIN, 3000);
+        player->ADD_GOSSIP_ITEM( 7, "Other Gifts ->", GOSSIP_SENDER_MAIN, 4000);
+    }
+
+    player->ADD_GOSSIP_ITEM( 10, "Remove Resurrect Sickness", GOSSIP_SENDER_MAIN, 5000);
+
+    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetGUID());
+
+return true;
+}
+
+void SendDefaultMenu_NPC_Buff(Player *player, Creature *_Creature, uint32 action )
+{
+
+// Not allow in combat
+if(!player->getAttackers().empty())
+{
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->MonsterSay("You are in combat!", LANG_UNIVERSAL, NULL);
+    return;
+}
+
+switch(action)
+{
+
+case 1000: // Small Buff
+    player->ADD_GOSSIP_ITEM( 5, "Give me Mark of the Wild"                          , GOSSIP_SENDER_MAIN, 1001);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Thorns"                                    , GOSSIP_SENDER_MAIN, 1005);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Amplify Magic"                             , GOSSIP_SENDER_MAIN, 1010);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Arcane Intellect"                          , GOSSIP_SENDER_MAIN, 1015);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Dampen Magic"                              , GOSSIP_SENDER_MAIN, 1025);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Blessing of Kings"                         , GOSSIP_SENDER_MAIN, 1030);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Blessing of Might"                         , GOSSIP_SENDER_MAIN, 1035);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Blessing of Wisdom"                        , GOSSIP_SENDER_MAIN, 1040);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Divine Spirit"                             , GOSSIP_SENDER_MAIN, 1045);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Power Word: Fortitude"                     , GOSSIP_SENDER_MAIN, 1050);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Shadow Protection"                         , GOSSIP_SENDER_MAIN, 1055);
+    player->ADD_GOSSIP_ITEM( 7, "<- Main Menu"                                      , GOSSIP_SENDER_MAIN, 5005);
+    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetGUID());
+    break;
+
+case 3000: // GM Buff
+    player->ADD_GOSSIP_ITEM( 5, "Give me Agamaggan's Agility"                       , GOSSIP_SENDER_MAIN, 3001);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Agamaggan's Strength"                      , GOSSIP_SENDER_MAIN, 3005);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Increased Stamina"                         , GOSSIP_SENDER_MAIN, 3020);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Razorhide"                                 , GOSSIP_SENDER_MAIN, 3025);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Rising Spirit"                             , GOSSIP_SENDER_MAIN, 3030);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Spirit of the Wind"                        , GOSSIP_SENDER_MAIN, 3035);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Wisdom of Agamaggan"                       , GOSSIP_SENDER_MAIN, 3040);
+    player->ADD_GOSSIP_ITEM( 7, "<- Main Menu"                                      , GOSSIP_SENDER_MAIN, 5005);
+    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetGUID());
+    break;
+
+case 4000: // Player Tools
+    player->ADD_GOSSIP_ITEM( 5, "Give me Gold"                                      , GOSSIP_SENDER_MAIN, 4001);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Soul Shards"                               , GOSSIP_SENDER_MAIN, 4005);
+    player->ADD_GOSSIP_ITEM( 5, "Maximize my Skills"
+    , GOSSIP_SENDER_MAIN, 4007);
+    player->ADD_GOSSIP_ITEM( 5, "Heal Me, Please"                                   , GOSSIP_SENDER_MAIN, 4010);
+    player->ADD_GOSSIP_ITEM( 7, "<- Main Menu"                                      , GOSSIP_SENDER_MAIN, 5005);
+    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetGUID());
+    break;
+
+case 5005: // Back To Main Menu
+    // Main Menu for Alliance
+    if ( player->GetTeam() == ALLIANCE )
+    {
+        player->ADD_GOSSIP_ITEM( 7, "Small Spells ->", GOSSIP_SENDER_MAIN, 1000);
+        player->ADD_GOSSIP_ITEM( 7, "GM Spells ->", GOSSIP_SENDER_MAIN, 3000);
+        player->ADD_GOSSIP_ITEM( 7, "Other Gifts ->", GOSSIP_SENDER_MAIN, 4000);
+    }
+    else // Main Menu for Horde
+    {
+        player->ADD_GOSSIP_ITEM( 7, "Small Spells ->", GOSSIP_SENDER_MAIN, 1000);
+        player->ADD_GOSSIP_ITEM( 7, "GM Spells ->", GOSSIP_SENDER_MAIN, 3000);
+        player->ADD_GOSSIP_ITEM( 7, "Other Gifts ->", GOSSIP_SENDER_MAIN, 4000);
+    }
+
+    player->ADD_GOSSIP_ITEM( 10, "Remove Resurrect Sickness", GOSSIP_SENDER_MAIN, 5000);
+    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetGUID());
+    break;
+
+// Small Buff
+
+case 1001: // Give me Mark of the Wild
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,9885,false);
+break;
+
+case 1005: // Give me Thorns
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,26992,false);
+break;
+
+case 1010: // Give me Amplify Magic
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,33946,false);
+break;
+
+case 1015: // Give me Arcane Intellect
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,27126,false);
+break;
+
+case 1025: // Give me Dampen Magic
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,33944,false);
+break;
+
+case 1030: // Give me Blessing of Kings
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,20217,false);
+break;
+
+case 1035: // Give me Blessing of Might
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,19838,false);
+break;
+
+case 1040: // Give me Blessing of Wisdom
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,25290,false);
+break;
+
+case 1045: // Give me Divine Spirit
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,25312,false);
+break;
+
+case 1050: // Give me Power Word: Fortitude
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,10938,false);
+break;
+
+case 1055: // Give me Shadow Protection
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,25433,false);
+break;
+
+// GM Buff
+
+case 3001: // Give me Agamaggan's Agility
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,17013,false);
+break;
+
+case 3005: // Give me Agamaggan's Strength
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,16612,false);
+break;
+
+case 3020: // Give me Increased Stamina
+    player->CLOSE_GOSSIP_MENU();
+    player->CastSpell(player,25661,false);
+break;
+
+case 3025: // Give me Razorhide
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,16610,false);
+break;
+
+case 3030: // Give me Rising Spirit
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,10767,false);
+break;
+
+case 3035: // Give me Spirit of the Wind
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,16618,false);
+break;
+
+case 3040: // Give me Wisdom of Agamaggan
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,7764,false);
+break;
+
+// Player Tools
+
+case 4001://Give me Gold
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,46642,false); // 5000 gold
+break;
+
+case 4005://Give me Soul Shards
+    player->CLOSE_GOSSIP_MENU();
+    player->CastSpell(player,24827,false);
+break;
+
+case 4007: // Update Skill to Max for Level      
+    player->CLOSE_GOSSIP_MENU();
+    player->UpdateSkillsToMaxSkillsForLevel();
+break;
+
+case 4010: // Heal me please
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,38588,false);
+break;
+
+case 5000://Remove Res Sickness
+    if(!player->HasAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS,0)) {
+        _Creature->MonsterWhisper("You are not suffering from resurrection sickness.", player->GetGUID());
+        GossipHello_NPC_Buff(player, _Creature);
+        return;
+    }
+
+    _Creature->CastSpell(player,38588,false); // Healing effect
+    player->RemoveAurasDueToSpell(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS);
+    player->CLOSE_GOSSIP_MENU();
+    break;
+
+    player->CLOSE_GOSSIP_MENU();
+
+    } // end of switch
+} //end of function
+
+bool GossipSelect_NPC_Buff(Player *player, Creature *_Creature, uint32 sender, uint32 action)
+{
+    // Main menu
+    if (sender == GOSSIP_SENDER_MAIN)
+        SendDefaultMenu_NPC_Buff( player, _Creature, action );
+    return true;
+}
+
+void AddSC_npc_buff()
+{
+    Script *newscript;
+    newscript = new Script;
+    newscript->Name = "npc_buff";
+    newscript->pGossipHello = &GossipHello_NPC_Buff;
+    newscript->pGossipSelect = &GossipSelect_NPC_Buff;
+    newscript->RegisterSelf();
+}
+
diff -Nuar oregoncore-current/src/scripts/Custom/npc_heal.cpp oregoncore-pq/src/scripts/Custom/npc_heal.cpp
--- oregoncore-current/src/scripts/Custom/npc_heal.cpp        1969-12-31 19:00:00.000000000 -0500
+++ oregoncore-pq/src/scripts/Custom/npc_heal.cpp        2011-01-01 10:10:24.000000000 -0500
@@ -0,0 +1,91 @@
+/* ScriptData
+SDName: NPC_Heal
+SD%Complete: 100
+SDComment: Healer
+SDCategory: NPC
+EndScriptData */
+
+#include "ScriptPCH.h"
+
+bool GossipHello_NPC_Heal(Player *player, Creature *_Creature)
+{
+    // Main Menu
+    player->ADD_GOSSIP_ITEM( 5, "Give me Blessing of Might"
+    , GOSSIP_SENDER_MAIN, 1035);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Blessing of Wisdom"
+    , GOSSIP_SENDER_MAIN, 1040);
+    player->ADD_GOSSIP_ITEM( 5, "Give me Power Word: Fortitude"
+    , GOSSIP_SENDER_MAIN, 1045);
+    player->ADD_GOSSIP_ITEM( 5, "Heal Me, Please"
+    , GOSSIP_SENDER_MAIN, 4010);
+    player->ADD_GOSSIP_ITEM( 5, "Remove Resurrect Sickness"
+    , GOSSIP_SENDER_MAIN, 5000);
+    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetGUID());
+    return true;
+}
+
+void SendDefaultMenu_NPC_Heal(Player *player, Creature *_Creature, uint32 action )
+{
+
+switch(action)
+{
+
+// Small Buff
+
+case 1035: // Give me Blessing of Might
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,19838,false);
+break;
+
+case 1040: // Give me Blessing of Wisdom
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,25290,false);
+break;
+
+case 1045: // Give me Power Word: Fortitude
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,10938,false);
+break;
+
+// Player Tools
+
+case 4010: // Heal me please
+    player->CLOSE_GOSSIP_MENU();
+    _Creature->CastSpell(player,38588,false);
+break;
+
+case 5000: // Remove Res Sickness
+    if(!player->HasAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS,0)) {
+        _Creature->MonsterWhisper("You do not have resurrection sickness.", player->GetGUID());
+        GossipHello_NPC_Heal(player, _Creature);
+        return;
+    }
+
+    _Creature->CastSpell(player,38588,false); // Healing effect
+    player->RemoveAurasDueToSpell(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS);
+    player->CLOSE_GOSSIP_MENU();
+    break;
+
+    player->CLOSE_GOSSIP_MENU();
+
+    } // end of switch
+} //end of function
+
+bool GossipSelect_NPC_Heal(Player *player, Creature *_Creature, uint32 sender, uint32 action)
+{
+    // Main menu
+    if (sender == GOSSIP_SENDER_MAIN)
+        SendDefaultMenu_NPC_Heal( player, _Creature, action );
+    return true;
+}
+
+void AddSC_npc_heal()
+{
+    Script *newscript;
+    newscript = new Script;
+    newscript->Name = "npc_heal";
+    newscript->pGossipHello = &GossipHello_NPC_Heal;
+    newscript->pGossipSelect = &GossipSelect_NPC_Heal;
+    newscript->RegisterSelf();
+}
+


请回复下载


游客,如果您要查看本帖隐藏内容请回复


标签:技能
 

精彩评论4

倒序浏览
dickeas 发表于 2021-12-24 22:19:26 | 显示全部楼层
 
这个怎么用啊
 
baodk 发表于 2021-9-1 19:39:41 | 显示全部楼层
 
现在的TBC单机版可用不
 
duck 发表于 2020-7-1 14:42:22 | 显示全部楼层
 
感谢楼主分享,祝愿吾爱尚玩越来越好!
 
你懂的 发表于 2016-12-12 05:18:07 | 显示全部楼层
 
找了好久终于找到了!吾爱尚玩真棒!
 
VIP介绍
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 最佳新人

    注册账号后积极发帖的会员
  • 活跃会员

    经常参与各类话题的讨论,发帖内容较有主见
  • 热心会员

    经常帮助其他会员答疑
  • 推广达人

    积极宣传本站,为本站带来更多注册会员
  • 宣传达人

    积极宣传本站,为本站带来更多的用户访问量
  • 灌水之王

    经常在论坛发帖,且发帖量较大
  • 突出贡献

    长期对论坛的繁荣而不断努力,或多次提出建设性意见
  • 优秀版主

    活跃且尽责职守的版主
  • 荣誉管理

    曾经为论坛做出突出贡献目前已离职的版主
  • 论坛元老

    为论坛做出突出贡献的会员

0关注

5粉丝

3421帖子

排行榜
作者专栏

QQ交流群&&微信订阅号

QQ交流群

微信订阅号

吾爱尚玩资源基地永久域名:

Www.523Play.Com

在线管理员QQ:1589479632

邮箱:Email@523play.com

QQ交流群:558936238

Copyright   ©2015-2116  吾爱尚玩资源基地|523play.comPowered by©523Pplay.Com技术支持:吾爱尚玩资源基地