首页 技术 正文
技术 2022年11月21日
0 收藏 671 点赞 4,995 浏览 2178 个字
 --[[作者信息:
Command Extra (游戏命令扩展)
作者QQ:247321453
作者Email:247321453@qq.com
修改日期:2014-3-12
功能:添加额外的命令、GM命令
]]--
print(">>Script: Command Extra.") --[[
.wmsg 内容 GM发送世界消息
.be 查看机器人装备
.npcbot equips 查看机器人装备
.rh GM回复生命
.reset hp GM回复生命
.gh 传送回家
.go home 传送回家
.卡 传送回家
]]--
local function ShowBotEquip(player)--查看机器人装备
local guid=player:GetGUIDLow()--得到玩家的guid
local target=player:GetSelection()--得到玩家选中对象
local text=""
if(target)then
if(target:GetTypeId()==)then--目标是生物
local Q = CharDBQuery("SELECT * FROM character_npcbot Where owner="..guid.." and entry="..target:GetEntry().." and active=1")
--player:Say("me: "..guid.." target:"..target:GetEntry(),0)
if(Q)then--查到相应的信息
text=target:GetName().."的装备:\n"
for i=, do
local item=Q:GetUInt32(i)--读取内容
if(item and item >)then
text=text..GetItemLink(item).." "
target:SendUnitWhisper(GetItemLink(item),player)--向玩家悄悄话
end
end
--target:SendUnitSay(text,0)
else
player:Say("没有找到机器人,或者没有选中机器人",)
end
else
player:Say("请选中一个机器人。",)
end
else
player:Say("请选中一个机器人。",)
end
return text
end local function ResetHP(player)
if(player:GetGMRank()>=)then--判断是不是GM
player:SetHealth(player:GetMaxHealth())
player:SendBroadcastMessage("已经回复生命。")
return false
else
return true
end
end local function Start(player)
player:CastSpell(player,,true)
player:ResetSpellCooldown(, true)
player:SendBroadcastMessage("已经回到家")
end local CMD={
["go home"]=function(player)
Start(player)
end,
["gh"]=function(player)
Start(player)
end,
["卡"]=function(player)
Start(player)
end,
["wmsg"]=function(player,msg)
if(player)then
if(player:GetGMRank()>=)then
SendWorldMessage(string.format("|cFFFF0000[系统]|r|cFFFFFF00%s|r",msg))
end
else
SendWorldMessage(string.format("|cFFFF0000[系统]|r|cFFFFFF00%s|r",msg))
end
end,
["be"]=function(player)--机器人装备
ShowBotEquip(player)
return false
end,
["npcbot equips"]=function(player)--机器人装备
ShowBotEquip(player)
return false
end,
["reset hp"]=function(player)--GM回复生命
ResetHP(player)
end,
["rh"]=function(player)--GM回复生命
ResetHP(player)
end,
} function CMD.Input(event, player, command)
local cmd,space,excmd=command,command:find(" ") or ,""
if(space>)then
cmd=command:sub(,space-)--主命令
excmd=command:sub(space+)--额外命令参数
end
local func=CMD[cmd]--用输入的命令去查找函数
if(func)then
return func(player,excmd) or false
end
end
--PLAYER_EVENT_ON_COMMAND = 42 -- (event, player, command) - Can return false
RegisterPlayerEvent(,CMD.Input)
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,991
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,505
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,349
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,134
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,766
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,844