关灯
开启左侧

仿官方魔兽世界私服模拟器-物品召唤NPC的脚本代码(M端TBC)

  [复制链接]
admin实名认证 发表于 2016-4-20 22:57:55 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
 
  1. 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
  2. +++ oregoncore-pq/sql/CMakeLists.txt        2011-01-01 10:15:59.000000000 -0500
  3. @@ -1,6 +1,7 @@
  4. add_subdirectory(updates)
  5. add_subdirectory(tools)
  6. add_subdirectory(scripts)
  7. +add_subdirectory(oc-patch)

  8. ########### install files ###############
  9. diff -Nuar oregoncore-current/sql/oc-patch/CMakeLists.txt oregoncore-pq/sql/oc-patch/CMakeLists.txt
  10. --- oregoncore-current/sql/oc-patch/CMakeLists.txt        1969-12-31 19:00:00.000000000 -0500
  11. +++ oregoncore-pq/sql/oc-patch/CMakeLists.txt        2011-01-01 10:15:59.000000000 -0500
  12. @@ -0,0 +1,6 @@
  13. +
  14. +########### install files ###############
  15. +
  16. +FILE(GLOB _SQL *.sql)
  17. +
  18. +install(FILES ${_SQL} DESTINATION share/oregon/sql/oc-patch)
  19. diff -Nuar oregoncore-current/sql/oc-patch/world-itemsummonnpc.sql oregoncore-pq/sql/oc-patch/world-itemsummonnpc.sql
  20. --- oregoncore-current/sql/oc-patch/world-itemsummonnpc.sql        1969-12-31 19:00:00.000000000 -0500
  21. +++ oregoncore-pq/sql/oc-patch/world-itemsummonnpc.sql        2011-01-01 10:15:59.000000000 -0500
  22. @@ -0,0 +1,20 @@
  23. +DELETE FROM `item_template` WHERE `entry` = 100035;
  24. +
  25. +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
  26. +(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);
  27. +
  28. +DELETE FROM `creature_template` WHERE `entry` = 91000;
  29. +
  30. +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
  31. +(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');
  32. +
  33. +CREATE TABLE IF NOT EXISTS `item_summonnpc` (
  34. +  `item_entry` mediumint(8) NOT NULL COMMENT 'item_template.entry',
  35. +  `creature_entry` mediumint(8) NOT NULL COMMENT 'creature_template.entry',
  36. +  `despawn` mediumint(8) unsigned NOT NULL default '60' COMMENT 'Time before despawn sec',
  37. +  PRIMARY KEY  (`item_entry`)
  38. +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Reference data for item_summonnpc script';
  39. +
  40. +INSERT INTO `item_summonnpc` (`item_entry`, `creature_entry`, `despawn`) VALUES
  41. +(100035, 91000, 60);
  42. +
  43. diff -Nuar oregoncore-current/src/game/ScriptLoader.cpp oregoncore-pq/src/game/ScriptLoader.cpp
  44. --- oregoncore-current/src/game/ScriptLoader.cpp        2011-01-01 10:03:08.000000000 -0500
  45. +++ oregoncore-pq/src/game/ScriptLoader.cpp        2011-01-01 10:15:59.000000000 -0500
  46. @@ -11,6 +11,9 @@

  47. #ifdef SCRIPTS

  48. +//custom
  49. +void AddSC_item_summonnpc();
  50. +
  51. //examples
  52. //void AddSC_custom_example();
  53. //void AddSC_custom_gossip_codebox();
  54. @@ -379,6 +382,10 @@
  55. void AddScripts()
  56. {
  57. #ifdef SCRIPTS
  58. +
  59. +    //Custom
  60. +    AddSC_item_summonnpc();
  61. +
  62. //    AddSC_custom_example();
  63. //    AddSC_custom_gossip_codebox();
  64. //    AddSC_test();
  65. diff -Nuar oregoncore-current/src/scripts/Custom/item_summonnpc.cpp oregoncore-pq/src/scripts/Custom/item_summonnpc.cpp
  66. --- oregoncore-current/src/scripts/Custom/item_summonnpc.cpp        1969-12-31 19:00:00.000000000 -0500
  67. +++ oregoncore-pq/src/scripts/Custom/item_summonnpc.cpp        2011-01-01 10:15:59.000000000 -0500
  68. @@ -0,0 +1,77 @@
  69. +/* Copyright (C) 2006 - 2009 ScriptDev2 <<a href="https://scriptdev2.svn.sourceforge.net/>" target="_blank">https://scriptdev2.svn.sourceforge.net/></a>
  70. + * Modified for OregonCore - Copyright (2010) Oregon <<a href="http://www.oregoncore.com" target="_blank">http://www.oregoncore.com</a>>
  71. + * Modifications by Celtus - 2010-09-13
  72. + *
  73. + * This program is free software; you can redistribute it and/or modify
  74. + * it under the terms of the GNU General Public License as published by
  75. + * the Free Software Foundation; either version 2 of the License, or
  76. + * (at your option) any later version.
  77. + *
  78. + * This program is distributed in the hope that it will be useful,
  79. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  80. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  81. + * GNU General Public License for more details.
  82. + *
  83. + * You should have received a copy of the GNU General Public License
  84. + * along with this program; if not, write to the Free Software
  85. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  86. + */
  87. +
  88. +/* ScriptData
  89. +SDName: item_summonnpc
  90. +SD%Complete: 100
  91. +SDComment: Summon NPC
  92. +SDCategory: Items
  93. +EndScriptData */
  94. +
  95. +#include "ScriptPCH.h"
  96. +#include <cstring>
  97. +
  98. +bool ItemUse_item_summonnpc(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
  99. +{
  100. +
  101. +    // Declare Variables
  102. +    uint32 itemId = pItem->GetEntry();
  103. +    uint32 npcId;
  104. +    uint32 despawnSec;
  105. +    extern DatabaseType WorldDatabase;
  106. +
  107. +if ((pPlayer->isInCombat()) || (pPlayer->isInFlight()) || (pPlayer->isDead()))
  108. +{
  109. +      pPlayer->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, NULL);
  110. +        return false;
  111. +}
  112. +if (pPlayer->IsMounted()) // Is player mounted
  113. +{
  114. +      pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
  115. +        return true;
  116. +}
  117. +{
  118. +        // Fetch the NPC Id
  119. +        QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT `creature_entry`, `despawn` FROM `item_summonnpc` WHERE `item_entry` = '%i' LIMIT 1",itemId);
  120. +    if(result)
  121. +    {
  122. +        Field *fields = result->Fetch();
  123. +        // Read NPC Id from the query result
  124. +        npcId = fields[0].GetInt32();
  125. +        // Read time before despawn
  126. +        despawnSec = fields[1].GetUInt32() * 1000;
  127. +        // Summon the NPC
  128. +        pPlayer->SummonCreature(npcId,pPlayer->GetPositionX() ,pPlayer->GetPositionY()-2, pPlayer->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, despawnSec);
  129. +        return true;
  130. +    } else {
  131. +        // Summons failed - show info in log
  132. +        outstring_log ("Item_SummonNPC Failed: %i)",itemId);
  133. +    }
  134. +}
  135. +        return false;
  136. +}
  137. +void AddSC_item_summonnpc()
  138. +{
  139. +    Script *newscript;
  140. +
  141. +    newscript = new Script;
  142. +    newscript->Name="item_summonnpc";
  143. +    newscript->pItemUse = &ItemUse_item_summonnpc;
  144. +    newscript->RegisterSelf();
  145. +}
复制代码
下载完整代码
下载地址
仿官方魔兽世界私服模拟器-物品召唤NPC的脚本代码(M端TBC).rar

 

精彩评论4

倒序浏览
神级丶 发表于 2025-5-7 23:29:57 | 显示全部楼层
 
好6,路过看看
 
52vista 发表于 2021-8-14 14:05:43 | 显示全部楼层
 
官方魔兽世界私服模拟器-物品召唤NPC的脚本代码
 
53506457 发表于 2021-3-27 22:10:10 | 显示全部楼层
 
非常感谢感谢
 
orphen008 发表于 2020-7-5 14:42:41 | 显示全部楼层
 
非常感谢楼主分享!!!
 
VIP介绍
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 最佳新人

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

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

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

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

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

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

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

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

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

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

0关注

6粉丝

3645帖子

排行榜
作者专栏

QQ交流群&&微信订阅号

QQ交流群

微信订阅号

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

Www.523Play.Com

在线管理员QQ:1589479632

邮箱:Email@523play.com

QQ交流群:558936238

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