关灯
开启左侧

魔兽服务端MANGOS-TBC版本带传送的地区引导师脚本

  [复制链接]
admin实名认证 发表于 2016-4-20 22:48:17 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
 
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:04:42.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-areaguardnpc.sql oregoncore-pq/sql/oc-patch/world-areaguardnpc.sql
--- oregoncore-current/sql/oc-patch/world-areaguardnpc.sql        1969-12-31 19:00:00.000000000 -0500
+++ oregoncore-pq/sql/oc-patch/world-areaguardnpc.sql        2011-01-01 10:04:42.000000000 -0500
@@ -0,0 +1,26 @@
+-- Table structure for table `npc_areaguard`
+
+CREATE TABLE IF NOT EXISTS `npc_areaguard` (
+  `creature_entry` mediumint(8) unsigned NOT NULL,
+  `guard_type` tinyint(3) unsigned NOT NULL default '0' COMMENT '0=All,1=Team,2=SecLvl,3=PlrLvl,4=Guild,5=PlrGuid',
+  `trigger_distance` float NOT NULL default '65' COMMENT 'In Feet - Max is 65',
+  `req_value` tinyint(3) unsigned NOT NULL default '0' COMMENT 'For Team 1=Ally,2=Horde',
+  `tele_map` mediumint(8) unsigned NOT NULL default '1' COMMENT 'Dflt tele dest is Ratchet',
+  `tele_x` float NOT NULL default '-955.726',
+  `tele_y` float NOT NULL default '-3747.16',
+  `tele_z` float NOT NULL default '5.47817',
+  `tele_o` float NOT NULL default '1.6369',
+  `comment` varchar(40) NOT NULL,
+  PRIMARY KEY  (`creature_entry`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='NPC Area Guard';
+
+-- Dumping data for table `npc_areaguard`
+
+INSERT INTO `npc_areaguard` (`creature_entry`, `guard_type`, `trigger_distance`, `req_value`, `tele_map`, `tele_x`, `tele_y`, `tele_z`, `tele_o`, `comment`) VALUES
+(92015, 0, 65, 0, 1, -955.726, -3747.16, 5.47817, 1.6369, 'Teleport all non-GM players to Ratchet');
+
+DELETE FROM `creature_template` WHERE `entry` = 92015;
+
+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
+(92015, 0, 10458, 0, 0, 0, 'Guard', '', NULL, 0, 70, 70, 12000, 12000, 4000, 4000, 12000, 35, 35, 129, 8, 1, 0, 2000, 50000, 0, 0, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 521411, 521411, '', 0, 3, 0, 1, 0, 0, 0, 'npc_areaguard');
+
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:04:42.000000000 -0500
@@ -11,6 +11,9 @@

#ifdef SCRIPTS

+//custom
+void AddSC_npc_areaguard();
+
//examples
//void AddSC_custom_example();
//void AddSC_custom_gossip_codebox();
@@ -379,6 +382,10 @@
void AddScripts()
{
#ifdef SCRIPTS
+
+    //Custom
+    AddSC_npc_areaguard();
+
//    AddSC_custom_example();
//    AddSC_custom_gossip_codebox();
//    AddSC_test();
diff -Nuar oregoncore-current/src/scripts/Custom/npc_areaguard.cpp oregoncore-pq/src/scripts/Custom/npc_areaguard.cpp
--- oregoncore-current/src/scripts/Custom/npc_areaguard.cpp        1969-12-31 19:00:00.000000000 -0500
+++ oregoncore-pq/src/scripts/Custom/npc_areaguard.cpp        2011-01-01 10:04:42.000000000 -0500
@@ -0,0 +1,135 @@
+#include "ScriptPCH.h"
+
+/*******************************************************
+ * npc_areaguard
+ *******************************************************/
+
+struct npc_areaguardAI : public Scripted_NoMovementAI
+{
+    npc_areaguardAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature)
+    {
+        pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+        pCreature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_NORMAL, true);
+        pCreature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
+    }
+
+    void Reset(){}
+
+    void Aggro(Unit* /*pWho*/){}
+
+    void AttackStart(Unit* /*pWho*/){}
+
+    void MoveInLineOfSight(Unit *pWho)
+    {
+        // Return if Distance is greater than maximum (65 ft) - saves data reads
+        if (!me->IsWithinDist(pWho, 65.0f, false))
+            return;
+
+        extern DatabaseType WorldDatabase;
+        uint32 creatureID = me->GetEntry();
+        uint32 guardType;
+        uint32 triggerDist;
+        uint32 reqValue;
+        uint32 teleMap;
+        float teleX,teleY,teleZ,teleO;
+
+        QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT `guard_type`, `trigger_distance`, `req_value`,`tele_map`,`tele_x`,`tele_y`,`tele_z`,`tele_o` FROM `npc_areaguard` WHERE `creature_entry` = %i LIMIT 1",creatureID);
+        if (result)
+        {
+            Field *fields = result->Fetch();
+            guardType = fields[0].GetUInt32();
+            triggerDist = fields[1].GetFloat();
+            reqValue = fields[2].GetUInt32();
+            teleMap = fields[3].GetUInt32();
+            teleX = fields[4].GetFloat();
+            teleY = fields[5].GetFloat();
+            teleZ = fields[6].GetFloat();
+            teleO = fields[7].GetFloat();
+        } else {
+            return;
+        }
+
+        if (!pWho || !pWho->IsInWorld())
+            return;
+
+        // Return if distance is greater than the trigger_distance
+        if (!me->IsWithinDist(pWho, triggerDist, false))
+            return;
+
+        Player *pPlayer = pWho->GetCharmerOrOwnerPlayerOrPlayerItself();
+
+        // Return if player has GM flag on or is in process of teleport
+        if (!pPlayer || pPlayer->isGameMaster() || pPlayer->IsBeingTeleported())
+            return;
+
+        switch (guardType)
+        {
+            case 0:
+                // Action on all players without GM flag on
+                pPlayer->TeleportTo(teleMap,teleX,teleY,teleZ,teleO);
+                break;
+            case 1:
+                {
+                // Action based on Team
+                if (reqValue == 1) // Alliance Required
+                    if (pPlayer->GetTeam() != 469) // Player is Horde
+                        pPlayer->TeleportTo(teleMap,teleX,teleY,teleZ,teleO);
+                if (reqValue == 2) // Horde Required
+                    if (pPlayer->GetTeam() != 67) // Player is Alliance
+                        pPlayer->TeleportTo(teleMap,teleX,teleY,teleZ,teleO);
+                }
+                break;
+            case 2:
+                {
+                // Action based on GM Level
+                if (pPlayer->GetSession()->GetSecurity() < reqValue)
+                    pPlayer->TeleportTo(teleMap,teleX,teleY,teleZ,teleO);
+                }
+                break;
+            case 3:
+                {
+                // Action based on Player Level
+                if (pPlayer->getLevel() < reqValue)
+                    pPlayer->TeleportTo(teleMap,teleX,teleY,teleZ,teleO);
+                }
+                break;
+            case 4:
+                {
+                // Action based on Guild ID
+                if (pPlayer->GetGuildId() != reqValue)
+                    pPlayer->TeleportTo(teleMap,teleX,teleY,teleZ,teleO);
+                }
+                break;
+            case 5:
+                {
+                // Action based on Player GUID
+                if (pPlayer->GetGUID() != reqValue)
+                    pPlayer->TeleportTo(teleMap,teleX,teleY,teleZ,teleO);
+                }
+                break;
+        }
+
+        float x,y,z,o;
+        me->GetHomePosition(x,y,z,o);
+        me->SetOrientation(o);
+        return;
+    }
+
+    void UpdateAI(const uint32 /*diff*/){}
+};
+
+CreatureAI* GetAI_npc_areaguard(Creature* pCreature)
+{
+    return new npc_areaguardAI(pCreature);
+}
+
+void AddSC_npc_areaguard()
+{
+    Script *newscript;
+
+    newscript = new Script;
+    newscript->Name = "npc_areaguard";
+    newscript->GetAI = &GetAI_npc_areaguard;
+    newscript->RegisterSelf();
+}
+


回复下载完整代码:


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


标签:服务端魔兽
 

精彩评论2

倒序浏览
仲夏丶绕圈圈 发表于 2020-7-13 17:37:55 | 显示全部楼层
 
好东西 有没有交怎么添加哈
 
123lwc 发表于 2020-5-11 17:19:28 | 显示全部楼层
 
下载看看压压惊
 
VIP介绍
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 最佳新人

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

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

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

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

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

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

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

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

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

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

0关注

5粉丝

3420帖子

排行榜
作者专栏

QQ交流群&&微信订阅号

QQ交流群

微信订阅号

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

Www.523Play.Com

在线管理员QQ:1589479632

邮箱:Email@523play.com

QQ交流群:558936238

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