当前位置:首页>>魔兽单机>>正文
仿官方魔兽单机-物品召唤NPC的脚本代码(M端TBC)
2013-03-30 12:51:54 作者:fiver 来源: 浏览次数:0
摘要:仿官方魔兽单机-物品召唤NPC的代码(M端TBC)
 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:15:59.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:15:59.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-itemsummonnpc.sql oregoncore-pq/sql/oc-patch/world-itemsummonnpc.sql
--- oregoncore-current/sql/oc-patch/world-itemsummonnpc.sql 1969-12-31 19:00:00.000000000 -0500
+++ oregoncore-pq/sql/oc-patch/world-itemsummonnpc.sql 2011-01-01 10:15:59.000000000 -0500
@@ -0,0 +1,20 @@
+DELETE FROM `item_template` WHERE `entry` = 100035;
+
+INSERT INTO `item_template` (`entry`, `class`, `subclass`, `unk0`, `name`, `displayid`, `Quality`, `Flags`, `BuyCount`, `BuyPrice`, `SellPrice`, `InventoryType`, `AllowableClass`, `AllowableRace`, `ItemLevel`, `RequiredLevel`, `RequiredSkill`, `RequiredSkillRank`, `requiredspell`, `requiredhonorrank`, `RequiredCityRank`, `RequiredReputationFaction`, `RequiredReputationRank`, `maxcount`, `stackable`, `ContainerSlots`, `stat_type1`, `stat_value1`, `stat_type2`, `stat_value2`, `stat_type3`, `stat_value3`, `stat_type4`, `stat_value4`, `stat_type5`, `stat_value5`, `stat_type6`, `stat_value6`, `stat_type7`, `stat_value7`, `stat_type8`, `stat_value8`, `stat_type9`, `stat_value9`, `stat_type10`, `stat_value10`, `dmg_min1`, `dmg_max1`, `dmg_type1`, `dmg_min2`, `dmg_max2`, `dmg_type2`, `dmg_min3`, `dmg_max3`, `dmg_type3`, `dmg_min4`, `dmg_max4`, `dmg_type4`, `dmg_min5`, `dmg_max5`, `dmg_type5`, `armor`, `holy_res`, `fire_res`, `nature_res`, `frost_res`, `shadow_res`, `arcane_res`, `delay`, `ammo_type`, `RangedModRange`, `spellid_1`, `spelltrigger_1`, `spellcharges_1`, `spellppmRate_1`, `spellcooldown_1`, `spellcategory_1`, `spellcategorycooldown_1`, `spellid_2`, `spelltrigger_2`, `spellcharges_2`, `spellppmRate_2`, `spellcooldown_2`, `spellcategory_2`, `spellcategorycooldown_2`, `spellid_3`, `spelltrigger_3`, `spellcharges_3`, `spellppmRate_3`, `spellcooldown_3`, `spellcategory_3`, `spellcategorycooldown_3`, `spellid_4`, `spelltrigger_4`, `spellcharges_4`, `spellppmRate_4`, `spellcooldown_4`, `spellcategory_4`, `spellcategorycooldown_4`, `spellid_5`, `spelltrigger_5`, `spellcharges_5`, `spellppmRate_5`, `spellcooldown_5`, `spellcategory_5`, `spellcategorycooldown_5`, `bonding`, `description`, `PageText`, `LanguageID`, `PageMaterial`, `startquest`, `lockid`, `Material`, `sheath`, `RandomProperty`, `RandomSuffix`, `block`, `itemset`, `MaxDurability`, `area`, `Map`, `BagFamily`, `TotemCategory`, `socketColor_1`, `socketContent_1`, `socketColor_2`, `socketContent_2`, `socketColor_3`, `socketContent_3`, `socketBonus`, `GemProperties`, `RequiredDisenchantSkill`, `ArmorDamageModifier`, `ScriptName`, `DisenchantID`, `FoodType`, `minMoneyLoot`, `maxMoneyLoot`, `Duration`) VALUES
+(100035, 13, 0, -1, 'Summon the Supreme Mage', 12735, 4, 524353, 1, 0, 0, 0, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28750, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, -1, 3, 'Summon the Buff Master', 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 'item_summonnpc', 0, 0, 0, 0, 0);
+
+DELETE FROM `creature_template` WHERE `entry` = 91000;
+
+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, '', 0, 3, 0, 1, 0, 0, 0, 'npc_buff');
+
+CREATE TABLE IF NOT EXISTS `item_summonnpc` (
+  `item_entry` mediumint(8) NOT NULL COMMENT 'item_template.entry',
+  `creature_entry` mediumint(8) NOT NULL COMMENT 'creature_template.entry',
+  `despawn` mediumint(8) unsigned NOT NULL default '60' COMMENT 'Time before despawn sec',
+  PRIMARY KEY  (`item_entry`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Reference data for item_summonnpc script';
+
+INSERT INTO `item_summonnpc` (`item_entry`, `creature_entry`, `despawn`) VALUES
+(100035, 91000, 60);
+
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:15:59.000000000 -0500
@@ -11,6 +11,9 @@
 
 #ifdef SCRIPTS
 
+//custom
+void AddSC_item_summonnpc();
+
 //examples
 //void AddSC_custom_example();
 //void AddSC_custom_gossip_codebox();
@@ -379,6 +382,10 @@
 void AddScripts()
 {
 #ifdef SCRIPTS
+
+    //Custom
+    AddSC_item_summonnpc();
+
 //    AddSC_custom_example();
 //    AddSC_custom_gossip_codebox();
 //    AddSC_test();
diff -Nuar oregoncore-current/src/scripts/Custom/item_summonnpc.cpp oregoncore-pq/src/scripts/Custom/item_summonnpc.cpp
--- oregoncore-current/src/scripts/Custom/item_summonnpc.cpp 1969-12-31 19:00:00.000000000 -0500
+++ oregoncore-pq/src/scripts/Custom/item_summonnpc.cpp 2011-01-01 10:15:59.000000000 -0500
@@ -0,0 +1,77 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
+ * Modified for OregonCore - Copyright (2010) Oregon <http://www.oregoncore.com>
+ * Modifications by Celtus - 2010-09-13
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/* ScriptData
+SDName: item_summonnpc
+SD%Complete: 100
+SDComment: Summon NPC
+SDCategory: Items
+EndScriptData */
+
+#include "ScriptPCH.h"
+#include <cstring>
+
+bool ItemUse_item_summonnpc(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
+{
+
+    // Declare Variables
+    uint32 itemId = pItem->GetEntry();
+    uint32 npcId;
+    uint32 despawnSec;
+    extern DatabaseType WorldDatabase;
+
+if ((pPlayer->isInCombat()) || (pPlayer->isInFlight()) || (pPlayer->isDead()))
+{
+      pPlayer->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, NULL);
+        return false;
+}
+if (pPlayer->IsMounted()) // Is player mounted
+{
+      pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
+        return true;
+}
+{
+        // Fetch the NPC Id
+        QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT `creature_entry`, `despawn` FROM `item_summonnpc` WHERE `item_entry` = '%i' LIMIT 1",itemId);
+    if(result)
+    {
+        Field *fields = result->Fetch();
+        // Read NPC Id from the query result
+        npcId = fields[0].GetInt32();
+        // Read time before despawn
+        despawnSec = fields[1].GetUInt32() * 1000;
+        // Summon the NPC
+ pPlayer->SummonCreature(npcId,pPlayer->GetPositionX() ,pPlayer->GetPositionY()-2, pPlayer->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, despawnSec);
+        return true;
+    } else {
+        // Summons failed - show info in log
+        outstring_log ("Item_SummonNPC Failed: %i)",itemId);
+    }
+}
+        return false;
+}
+void AddSC_item_summonnpc()
+{
+    Script *newscript;
+
+    newscript = new Script;
+    newscript->Name="item_summonnpc";
+    newscript->pItemUse = &ItemUse_item_summonnpc;
+    newscript->RegisterSelf();


 


相关报道:

[关闭] [返回顶部]


  返回首页 | 最新资讯 | 资源下载 | 魔兽图片 | 单机文档 | 技术攻略 | 玩家视频
备案号:蜀ICP备2024062380号-1
免责声明:本网站为热爱怀旧WOW的玩家们建立的魔兽世界资料网站,仅供交流和学习使用,非盈利和商用.如有侵权之处,请联系我们,我们会在24小时内确认删除侵权内容,谢谢合作。
Copyright © 2024 - 2024 WOWAII.COM Corporation, All Rights Reserved

机器人国度