Worldchat.lua--World Chat

Source: Internet
Author: User

Print (">>script:wolrd chating.")

Local say= ""--general Chat

Local team_alliance = 0--Alliance Camp
Local Team_horde = 1--Tribal camp
Local myequip= "~me"
Local class={--Occupation No.
WARRIOR = 1,--warrior
PALADIN = 2,--Paladin
HUNTER = 3,--Hunter
ROGUE = 4,--Rogue
Priest = 5,--Priest
Death_knight = 6,--Death knight
Shaman = 7,--Shaman
MAGE = 8,--Mage
Warlock = 9,--Warlock
DRUID = 11,--Druid
}

Local classname={--Professional table
[CLASS. WARRIOR] = "Warrior",
[CLASS. PALADIN] = "Paladin",
[CLASS. HUNTER] = "Hunter",
[CLASS. ROGUE] = "rogue",
[CLASS. Priest] = "Priest",
[CLASS. death_knight]= "Death Knight",
[CLASS. Shaman] = "Shaman",
[CLASS. MAGE] = "Mage",
[CLASS. Warlock] = "Warlock",
[CLASS. DRUID] = "Druid",
}
Local function Getplayerinfo (player)--Get player info
Local Pclass = Classname[player:getclass ()] or "???"--Get the job
Local Pname = Player:getname ()
Local Pteam = ""
Local Team=player:getteam ()
if (team==team_alliance) then
Pteam= "|cff0070d0 Union |r"
ElseIf (Team==team_horde) Then
Pteam= "|cfff000a0 Tribe |r"
End
Return String.Format ("%s%s player [|cff00ff00| Hplayer:%s|h%s|h|r] ", Pteam,pclass,pname,pname)
End

Local function Showallequip (player, Isworld)

Local Ts=os.date ("*t", Time)
Local T=string.format ("%2d:%2d:%2d", ts.hour,ts.min,ts.sec)
Local Pinfo=getplayerinfo (player)
Local Head=string.format ("[World] |cfff08000%s|r%s" said, "T,pinfo)
if (Isworld) then
Sendworldmessage (head: " Everybody, look at my gear. ")
Else
Player:say (head: " Everybody, look at my gear. ", 0)
End

For i=0,18 do
Local Item=player:getequippeditembyslot (i)
if (item) then
if (Isworld) then
Sendworldmessage (head.. Item:getitemlink ())
Else
Player:say (head.. Item:getitemlink (), 0)
End
End
End
End

Local function Playeronchat (event, player, MSG, Type, Lang)--World Chat
Local Ts=os.date ("*t", Time)
Local T=string.format ("%2d:%2d:%2d", ts.hour,ts.min,ts.sec)
Local Head=string.format ("[World]|cfff08000%s|r%s said:", T,getplayerinfo (player))
if (String.find (Msg,say) ==1) Then
Player:say (Msg:sub (Say:len () +1), 0)
return False
ElseIf (Msg==myequip) Then
Showallequip (player, true)
Else
Sendworldmessage (String.Format ("%s|cffffffff%s|r", head,msg))
return False
End
End
--player_event_on_chat =-(EVENT, PLAYER, MSG, Type, Lang)-Can return False
Registerplayerevent (Playeronchat)--World Chat

Worldchat.lua--World Chat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.