TeleportStone.lua --传送宝石

  1 --[[作者信息:
  2     超级炉石  (Teleport stone)
  3     作者QQ:247321453
  4     作者Email:247321453@qq.com
  5     修改日期:2014-3-12
  6     功能:除了传送,还有召唤NPC,其他更多功能
  7 ]]--
  8 
  9 print(">>Script: Teleport stone.")
 10 --54844
 11 --菜单所有者 --默认炉石
 12 local itemEntry    =6948
 13 --阵营
 14 local TEAM_ALLIANCE=0
 15 local TEAM_HORDE=1
 16 --菜单号
 17 local MMENU=1
 18 local TPMENU=2
 19 local GMMENU=3
 20 local ENCMENU=4
 21 --菜单类型
 22 local FUNC=1
 23 local MENU=2
 24 local TP=3
 25 local ENC=4
 26 
 27 --GOSSIP_ICON 菜单图标
 28 local GOSSIP_ICON_CHAT            = 0                    -- 对话
 29 local GOSSIP_ICON_VENDOR          = 1                    -- 货物
 30 local GOSSIP_ICON_TAXI            = 2                    -- 传送
 31 local GOSSIP_ICON_TRAINER         = 3                    -- 训练(书)
 32 local GOSSIP_ICON_INTERACT_1      = 4                    -- 复活
 33 local GOSSIP_ICON_INTERACT_2      = 5                    -- 设为我的家
 34 local GOSSIP_ICON_MONEY_BAG         = 6                    -- 钱袋
 35 local GOSSIP_ICON_TALK            = 7                    -- 申请 说话+黑色点
 36 local GOSSIP_ICON_TABARD          = 8                    -- 工会(战袍)
 37 local GOSSIP_ICON_BATTLE          = 9                    -- 加入战场 双剑交叉
 38 local GOSSIP_ICON_DOT             = 10                   -- 加入战场
 39 
 40 --装备位置
 41 local EQUIPMENT_SLOT_HEAD         = 0--头部
 42 local EQUIPMENT_SLOT_NECK         = 1--颈部
 43 local EQUIPMENT_SLOT_SHOULDERS    = 2--肩部
 44 local EQUIPMENT_SLOT_BODY         = 3--身体
 45 local EQUIPMENT_SLOT_CHEST        = 4--胸甲
 46 local EQUIPMENT_SLOT_WAIST        = 5--腰部
 47 local EQUIPMENT_SLOT_LEGS         = 6--腿部
 48 local EQUIPMENT_SLOT_FEET         = 7--脚部
 49 local EQUIPMENT_SLOT_WRISTS       = 8--手腕
 50 local EQUIPMENT_SLOT_HANDS        = 9--手套
 51 local EQUIPMENT_SLOT_FINGER1      = 10--手指1
 52 local EQUIPMENT_SLOT_FINGER2      = 11--手指2
 53 local EQUIPMENT_SLOT_TRINKET1     = 12--饰品1
 54 local EQUIPMENT_SLOT_TRINKET2     = 13--饰品2
 55 local EQUIPMENT_SLOT_BACK         = 14--背部
 56 local EQUIPMENT_SLOT_MAINHAND     = 15--主手
 57 local EQUIPMENT_SLOT_OFFHAND      = 16--副手
 58 local EQUIPMENT_SLOT_RANGED       = 17--远程
 59 local EQUIPMENT_SLOT_TABARD       = 18--徽章
 60 
 61 local Instances={
    --副本表
 62         {
    249,0},{
    249,1},{
    269,1},{
    309,0},
 63         {
    409,0},{
    469,0},
 64         {
    509,0},{
    531,0},{
    532,0},{
    533,0},{
    533,1},
 65         {
    534,0},{
    540,1},{
    542,1},{
    543,1},{
    544,0},{
    545,1},{
    546,1},{
    547,1},{
    548,0},
 66         {
    550,0},{
    552,1},{
    553,1},{
    554,1},{
    555,1},{
    556,1},{
    557,1},{
    558,1},
 67         {
    560,1},{
    564,0},{
    565,0},{
    568,0},
 68         {
    574,1},{
    575,1},{
    576,1},{
    578,1},
 69         {
    580,0},{
    585,1},{
    595,1},{
    598,1},{
    599,1},
 70         {
    600,1},{
    601,1},{
    602,1},{
    603,0},{
    603,1},{
    604,1},{
    608,1},
 71         {
    615,0},{
    615,1},{
    616,0},{
    616,1},{
    619,1},{
    624,0},{
    624,1},
 72         {
    631,0},{
    631,1},{
    631,2},{
    631,3},{
    632,1},
 73         {
    649,0},{
    649,1},{
    649,2},{
    649,3},--十字军的试炼
 74         {
    650,1},{
    658,1},{
    668,1},
 75         {
    724,0},{
    724,1},{
    724,2},{
    724,3},
 76 }
 77 --随身NPC
 78 local ST={
 79     TIME=45,--45秒
 80     NPCID1=190098,
 81     NPCID2=190099,
 82     --[guid]=lasttime,
 83 }
 84 
 85 function ST.SummonNPC(player, entry)
 86     local guid=player:GetGUIDLow()
 87     local lastTime,nowTime=(ST[guid] or 0),os.time()
 88 
 89     if(player:IsInCombat())then
 90         player:SendAreaTriggerMessage("不能在战斗中召唤。")
 91     else
 92         if(nowTime>lastTime)then
 93             local map=player:GetMap()
 94             if(map)then
 95                 player:SendAreaTriggerMessage(map:GetName())
 96                 local x,y,z=player:GetX()+1,player:GetY(),player:GetZ()
 97                 local nz=map:GetHeight(x,y)
 98                 if(nz>z and nz<(z+5))then
 99                     z=nz
100                 end
101                 local NPC=player:SpawnCreature(entry,x,y,z,0, 3,ST.TIME*1000)
102                 if(NPC)then
103                     player:SendAreaTriggerMessage("召唤随身商人成功。")
104                     NPC:SetFacingToObject(player)
105                     NPC:SendUnitSay(string.format("%s,你好,需要点什么?",player:GetName()),0)
106                     lastTime=os.time()+ST.TIME
107                 else
108                     player:SendAreaTriggerMessage("召唤随身商人失败。")
109                 end
110             end
111         else
112             player:SendAreaTriggerMessage("召唤NPC不能太频繁。")
113         end
114     end
115     ST[guid]=lastTime
116 end
117 
118 function ST.SummonGNPC(player)--召唤商人
119     ST.SummonNPC(player, ST.NPCID2)
120 end
121 
122 function ST.SummonENPC(player)--召唤附魔
123     ST.SummonNPC(player, ST.NPCID1)
124 end
125 
126 local function ResetPlayer(player, flag, text)
127     player:SetAtLoginFlag(flag)
128     player:SendAreaTriggerMessage("你需要重新登录角色,才能修改"..text.."")
129     player:SendAreaTriggerMessage("正在返回选择角色菜单")
130     player:LogoutPlayer(true)
131 end
132 
133 local Stone={
134     GetTimeASString=function(player)
135         local inGameTime=player:GetTotalPlayedTime()
136         local days=math.modf(inGameTime/(24*3600))
137         local hours=math.modf((inGameTime-(days*24*3600))/3600)
138         local mins=math.modf((inGameTime-(days*24*3600+hours*3600))/60)
139         return days..""..hours..""..mins..""
140     end,
141     GoHome=function(player)--回到家
142         player:CastSpell(player,8690,true)    
143         player:ResetSpellCooldown(8690, true)    
144         player:SendBroadcastMessage("已经回到家")
145     end,
146 
147     SetHome=function(player)--设置当前位置为家
148         local x,y,z,mapId,areaId=player:GetX(),player:GetY(),player:GetZ(),player:GetMapId(),player:GetAreaId() 
149         player:SetBindPoint(x,y,z,mapId,areaId)
150         player:SendBroadcastMessage("已经设置当前位置为家")
151     end,
152 
153     OpenBank=function(player)--打开银行
154         player:SendShowBank(player)
155         player:SendBroadcastMessage("已经打开银行")
156     end,
157 
158     WeakOut=function(player)--移除复活虚弱
159         if(player:HasAura(15007))then
160             player:RemoveAura(15007)    --移除复活虚弱
161             player:SetHealth(player:GetMaxHealth())
162             --self:RemoveAllAuras()    --移除所有状态
163             player:SendBroadcastMessage("你的身上的复活虚弱状态已经被移除。")
164         else
165             player:SendBroadcastMessage("你的身上没有复活虚弱状态。")
166         end
167     end,
168 
169     OutCombat=function(player)--脱离战斗
170         if(player:IsInCombat())then
171             player:ClearInCombat()
172             player:SendAreaTriggerMessage("你已经脱离战斗")
173             player:SendBroadcastMessage("你已经脱离战斗。")
174         else
175             player:SendAreaTriggerMessage("你并没有在战斗。")
176             player:SendBroadcastMessage("你并没有在战斗。")
177         end
178     end,
179 
180     WSkillsToMax=function(player)--技能熟练度
181         player:AdvanceSkillsToMax()
182         player:SendBroadcastMessage("当前技能熟练度已经达到最大值")
183     end,
184     MaxHealth=function(player)    --回复生命
185         player:SetHealth(player:GetMaxHealth())
186         player:SendBroadcastMessage("生命值已经回满。")
187     end,
188     ResetTalents = function(player)--重置天赋
189         player:ResetTalents(true)--免费
190         player:SendBroadcastMessage("已经重置天赋")
191     end,
192 
193     ResetPetTalents=function(player)--重置宠物天赋
194         player:ResetPetTalents()
195         player:SendBroadcastMessage("已经重置宠物天赋")
196     end,
197 
198     ResetAllCD=function(player)--刷新冷却
199         player:ResetAllCooldowns()
200         player:SendBroadcastMessage("已经重置物品和技能冷却")
201     end,
202 
203     RepairAll=function(player)--修理装备
204         player:DurabilityRepairAll(true,1,false)
205         player:SendBroadcastMessage("修理完所有装备。")
206     end,
207 
208     SaveToDB=function(player)--保存数据
209         player:SaveToDB()
210         player:SendAreaTriggerMessage("保存数据完成")
211     end,
212 
213     Logout=function(player)--返回选择角色
214         player:SendAreaTriggerMessage("正在返回选择角色菜单")
215         player:LogoutPlayer(true)
216     end,
217 
218     LogoutNosave=function(player)--不保存数据,返回选择角色
219         player:SendAreaTriggerMessage("正在返回选择角色菜单")
220         player:LogoutPlayer(false)
221     end,
222     UnBind=function(player)    --副本解绑
223         local nowmap=player:GetMapId()
224         for k, v in pairs(Instances) do 
225             local mapid=v[1]
226             if(mapid~=nowmap)then
227                 player:UnbindInstance(v[1],v[2])
228             else
229                 player:SendBroadcastMessage("你所在的当前副本无法解除绑定。")
230             end
231         end
232         player:SendAreaTriggerMessage("已经解除所有副本的绑定")
233         player:SendBroadcastMessage("已经解除所有副本的绑定。")
234     end,    
235     --[[登录标志
236     AT_LOGIN_RENAME            = 0x01,
237     AT_LOGIN_RESET_SPELLS      = 0x0
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值