prepare for malaysia trip

  • what opentok – api can do

: to generate OpenTok sessions (session 相当于房间 ),

session never expired , also can not be explicit destroy .  user connect to session use token , token can be expired.


once a session is created ,  should define  how clients in the session will send audio-video streams,  there are two types :

a) Relayed   : mean p2p ,  but if in case can not connect cause firewall or other reason , will use opentok TURN server to relay .

b)Routed , 全部由 opentok 中转

The OpenTok Media Router supports the OpenTok archiving feature,  是否想录像必须是这个模式

In clients using the OpenTok iOS and Android SDKs, relayed sessions support only two clients connected to the session. The OpenTok Media Router supports additional clients for multiparty sessions on mobile devices.

手机版 relay 模式只支持2个client直连

如果正确选择这2种模式?

Choosing Relayed vs. Routed session type

Use a relayed instead of a routed session, if you have only two participants (or maybe even three) and you are not using archiving. Using relayed sessions reduces the latency between participants, reduces the points of failure and you can get better quality video and audio in most cases.

Routed sessions are required if you want to archive your session. They are recommended if you have more than two or three participants in the session.

以上部分来自: https://tokbox.com/developer/guides/create-session/


  • How to create session on server side :  use node.js example

From  https://tokbox.com/developer/guides/create-session/node/

How to create token :  From https://tokbox.com/developer/guides/create-token/node/

之后, client 怎么知道 这个session id 和 token  ????

  • session 自带一些事件, 可以给这些事件设置回调, 比如统计room的在线人数

 

 

  • how many types of opentok-api

web;  android ; IOS; windows desktop;

  • show android and web example

 

 

 

 

 

 

  • what is web-rtc

mean :  web Real-Time Communications

 

How to write to a file in wow addon

来源网址:  https://us.battle.net/forums/en/wow/topic/20043655806

 

 

 

World of Warcraft
Forums
UI and Macro
Can an addon write to a log file?
The World of Warcraft community forums have moved!
These forums are in read-only mode. Please visit the new World of Warcraft community forums at https://us.forums.blizzard.com/en/wow

Can an addon write to a log file?
UI AND MACRO

Cold
<God Tier>
110 Human Mage
11030
3138 posts
Dec 12, 2015
Does wow allow addons to write data to a txt file for example?

Gello
<Underhill>
100 Gnome Priest
16605
4654 posts
Dec 12, 2015
Not directly. All file i/o is removed from addons.

However, an addon can tag a variable to be saved in the SavedVariables folder under the addon’s name. An addon can tag it to save in a global file or a per-character file.

And this variable can record stuff over time to create a log. (It’s how addons can keep track of stuff over time)

While this file can’t be forced into a format immediately recognizable to an outside program (unless it reads lua files), there may be an ODBC written up for doing this to convert to Access or maybe a csv for Excel or something.

Cold
<God Tier>
110 Human Mage
11030
3138 posts
Dec 12, 2015
Any chance you could link me to what you are talking about?

Every page I looked at has a common theme: Blizzard won’t allow io because of bots.

Never even heard a mention about what you just said.

Gello
<Underhill>
100 Gnome Priest
16605
4654 posts
Dec 12, 2015
I don’t know if this would qualify as a link for this intended purpose but:
http://wow.gamepedia.com/Saving_variables_between_game_sessions

It’s easier to explain by example. Create the two files named in bold in a folder called TargetLog under AddOns:

TargetLog.toc
## Interface: 60200
## Title: TargetLog
## Notes: Uses SavedVariables to log targets across multiple sessions
## SavedVariables: TargetLogData
TargetLog.lua

TargetLog.lua
TargetLogData = {} — initial value (will be overwritten when/if SavedVariables load)
local f = CreateFrame(“Frame”)
f:SetScript(“OnEvent”,function(self)
if UnitExists(“target”) then
local name = UnitName(“target”)
local level = UnitLevel(“target”)
local health = UnitHealthMax(“target”)
— adds date/time,name,level,health of target to TargetLogData
tinsert(TargetLogData,format(“%s,%s,%s,%s”,date(),name,level,health))
end
end)
f:RegisterEvent(“PLAYER_TARGET_CHANGED”)

The next time you log in, as you target stuff, it gathers a few bits of info about your target and adds it to a table (TargetLogData). This data will accumulate across sessions (the purpose of SavedVariables is to keep stuff between sessions).

Note the ## SavedVariables: TargetLogData in the .toc. This is where you tag a variable to save. Then the addon itself fills the variable (almost always a table) with stuff.

Now when you logout or reload (and ONLY when you logout or reload–addons can’t control when this stuff writes beyond forcing a /reload which a user is generally not going to want while they play), the contents of TargetLogData is saved to the file WTF\Account\%accountname%\SavedVariables\TargetLog.lua. This is a text file that looks like:

TargetLogData = {
“12/12/15 00:19:57,Lunarfall Infantry,100,195708”, — [1]
“12/12/15 00:19:59,Muradin Bronzebeard,100,29356200”, — [2]
“12/12/15 00:20:02,Deedree,90,17503”, — [3]
“12/12/15 00:20:05,Captain Towix,100,97854”, — [4]
“12/12/15 00:20:06,Officer Jeor,100,97854”, — [5]
“12/12/15 00:20:08,Alliance Sailor,100,1467810”, — [6]
“12/12/15 00:20:09,Lieutenant Thorn,94,63226”, — [7]
“12/12/15 00:20:11,Shield Captain Chien,100,97854”, — [8]
“12/12/15 00:20:13,Sentinel Dawnshadow,100,97854”, — [9]
“12/12/15 00:20:15,Ro,100,385260”, — [10]
“12/12/15 00:20:18,Lunarfall Infantry,100,195708”, — [11]
“12/12/15 00:20:19,Porter,2,50”, — [12]
“12/12/15 00:20:22,Seer Kazal,100,97854”, — [13]
“12/12/15 00:20:24,Aenir,90,14002”, — [14]
“12/12/15 00:20:25,Squiggy,90,35006”, — [15]
“12/12/15 00:20:27,Rooter the Ravenous,100,146781”, — [16]
“12/12/15 00:20:28,Lio the Lioness,98,65312”, — [17]
“12/12/15 00:20:29,Quintessence of Light,25,788”, — [18]
}

This is a lua table of the data saved. When you log in later, part of the addon loading process is to run any existing SavedVariables files, so the table you saved on last logout is created with previous data on next login.

That is the complete and total extent that addons are allowed to write files.

An addon cannot change the structure of this file. The table name and syntax (table = { stuff, stuff, stuff, etc }) is there so it can be run. An addon has no control over this. The game creates it for its own purpose and makes no accomidation for outside programs to read it. If they ever change the structure of this file it would probably be to encrypt it so outside programs can’t use it.

To use it as a log for an outside program would require massaging this text to remove the syntax stuff to get a CSV or whatever format you choose. And it’s important to remember that this stuff only writes on a logout/reload. They don’t want it writing in realtime to prevent outside programs from learning about what’s going on in the game.

Cold
<God Tier>
110 Human Mage
11030
3138 posts
Dec 12, 2015
Thanks!
Join the Conversation
Have something to say? Log in to join the conversation.
Thanks for visiting the Blizzard Forums (3.8.2) · Patch Notes
CAREERSABOUTSUPPORTCONTACT USPRESSAPI
©2019 BLIZZARD ENTERTAINMENT, INC. ALL RIGHTS RESERVED.
All trademarks referenced herein are the properties of their respective owners.
PRIVACYLEGALTERMSCOOKIES
en-US

How classic addon spy find nearby pl ?

  • 所有注册的事件:

 

  • 关键函数

function Spy:ShowAlert(type, name, source, location)   in  MainWindow.lua

function Spy:AlertProwlPlayer(player)                                   in  List.lua

function Spy:CombatLogEvent(…)                                            in Spy.lua


判断 level :  用这个函数

function Spy:ParseUnitAbility(analyseSpell, event, player, flags, spellId, spellName)                                  In :   List.lua

 

  • 启动顺序

在 spy.xml 的 OnUpdate 事件中: 指定了当update发生时的执行函数

之后执行到 Spy.lua 的:

GameTooltipTextLeft1 这个是 wow 自带函数 ,功能是 :  Google GameTooltipTextLeft1  或者 GameTooltipTextLeft1  函数

用法例子:

To see it’s effects try this:

GameTooltipTextLeft1:SetAlphaGradient(0,40)
Now, view any tooltip. You will see the text on the first line of the tooltip fade out as it approaches 40 pixels from the left. To set the tooltip back use:

GameTooltipTextLeft1:SetAlphaGradient(0,0)

 

CSS 符号及解释

  • <section>:

和 div 一样, 逻辑上的分段, 可以为其定义 css ,例如

  • @media 代表网页如何适应不用的浏览器或者手机尺寸

w3schools 的例子:  Change the background color of the <body> element to “lightblue” when the browser window is 600px wide or less:


opentok-rtc 的例子:


  • 各种 div 的用法

a)   index.ejs 右边容器的css定义为 :

在 html 中 :

在 less


enterroom 按钮的定义

 

 

opentok-rtc javascript 启动流程及结构设计

  • 最开始启动于 :  rtcApp.js

用 LazyLoader 启动了  5个 js 文件 , 之后 调用 RTCApp.init()

其中  view.init();  是调用具体view的 init 函数 ,对于 room来说就是 :  roomController.js—–> init  函数。

 

在 roomController.js 的 init 函数 , 有

参数中  roomStatusHandlers 是:

 

 

调用的是 :  browser_utils.js 的 addEventsHandlers  函数 :

 

 

 

 

 

less 详解

  • how to compile

in opentok-rtc project ,  use grunt to compile less into css .

Grunt 是一个插件化的打包工具, 比如编译 less的插件就是  grunt-contrib-less,  安装方法是 :

安装之后还需要 Gruntfile.js 做配置文件 ,

Grunt的 get start 网址: https://gruntjs.com/getting-started

配置文件例子 : https://gruntjs.com/sample-gruntfile

从 opentok截取出来的一个简单的Gruntfile.js 例子 , 这里只用到了编译 less的插件

之后执行  grunt  clientBuild 即可把 less 文件 编译为 css ,clientBuild  是自定义的任务名


  • How to add bower lib

在 opentok-rtc项目中, 还包括了 bower lib的引用 ,

in Gruntfile.js , it figure out where to find source less  and where to store dest css  ,  by  :

  • use which less lib ?   in tokbox-rtc . it use bower lib

npm install bower –save

之后新建 bower.json

bower install

  • opentok-rtc  room page css 分析

a)

这个是 image  , 代码为:

以data 开头的是 html5 新增的自定义属性, 可以是 data-whatever ,  具体定义见 icons.less

b)

这个是相当于radio的按钮, 可通过点击 enable 或者 not ,   用 js 实现 ,给 click 事件加 eventlistener , 从而在 class 加 activate 或者 去掉 , 示例代码:

 

 

 

 

 

  • 参考文章 :

all  css selector explains

https://www.w3schools.com/cssref/css_selectors.asp