Skip to content

Commit

Permalink
Use https for achieve wikipedia
Browse files Browse the repository at this point in the history
  • Loading branch information
haimanman committed Feb 17, 2017
1 parent b28e739 commit 4bcd7a3
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 48 deletions.
50 changes: 46 additions & 4 deletions HM_0Base/HM_About.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,47 @@ _HM_About.CheckLocalDeny = function()
end
end

-- get sync data
_HM_About.GetSyncData = function()
local me = GetClientPlayer()
local data = {
gid = me.GetGlobalID(),
name = GetUserRoleName(),
server = select(6, GetUserServer()),
school = me.dwForceID,
camp = me.nCamp,
body = me.nRoleType,
-- rank
avatar = me.dwMiniAvatarID,
pet = me.GetAcquiredFellowPetScore(),
score = me.GetTotalEquipScore(),
point = me.GetAchievementRecord(),
-- weapon, horse
__lang = select(3, GetVersion()),
}
-- weapon
local item = me.GetItem(INVENTORY_INDEX.EQUIP, EQUIPMENT_INVENTORY.MELEE_WEAPON)
if item then
data.weapon = item.szName
end
if me.dwForceID == 8 then
local item = me.GetItem(INVENTORY_INDEX.EQUIP, EQUIPMENT_INVENTORY.BIG_SWORD)
if item then
if not data.weapon then
data.weapon = item.szName
else
data.weapon = data.weapon .. ";" .. item.szName
end
end
end
-- horse
local item = me.GetEquippedHorse()
if item then
data.horse = item.szName
end
return data
end

-------------------------------------
-- 特殊名字处理
-------------------------------------
Expand Down Expand Up @@ -248,13 +289,13 @@ _HM_About.PS.OnTaboxCheck = function(frame, nIndex, szTitle)
local _, _, szLang = GetVersion()
ui:Append("Shadow", { x = 0, y = 5, w = 532, h = 168, alpha = 128 }):Color(128, 128, 128)
if szLang == "zhcn" then
ui:Append("Text", { x = 0, y = 5, font = 239, w = 532, h = 100, txt = "海鳗插件团队杭州招聘啦~" }):Align(1, 1)
ui:Append("Text", { x = 0, y = 70, font = 61, w = 532, h = 25, txt = "PHP/iOS/前端/产品策划运营等,详见微博置顶" }):Align(1, 1)
ui:Append("Text", { x = 0, y = 5, font = 239, w = 532, h = 100, txt = "海鳗团队杭州招聘啦~" }):Align(1, 1)
ui:Append("Text", { x = 0, y = 70, font = 61, w = 532, h = 25, txt = "PHP/iOS/前端/产品运营等,详见微博置顶" }):Align(1, 1)
else
ui:Append("Text", { x = 0, y = 5, font = 239, w = 532, h = 100, txt = "Empty color is the color that is empty." }):Align(1, 1)
end
ui:Append("Text", { x = 0, y = 85, font = 239, w = 532, h = 68, txt = _L["<Weibo@haimanman>"] }):Align(1, 1):Click(function()
OpenInternetExplorer("http://weibo.com/haimanman")
OpenInternetExplorer("https://weibo.com/haimanman")
end)
ui:Append("Text", { txt = _L("%s are welcome to use HM plug-in", szName), x = 10, y = 190, font = 19 })
ui:Append("Text", { txt = _L["Free & open source, Utility, Focus on PVP!"], x = 10, y = 220, font = 19 })
Expand All @@ -272,7 +313,7 @@ _HM_About.PS.OnTaboxCheck = function(frame, nIndex, szTitle)
--end):Pos_()
nX = ui:Append("Text", { txt = _L["<Set hotkeys>"], x = nX + 10, y = 305, font = 27 }):Click(HM.SetHotKey):Pos_()
nX = ui:Append("Text", { txt = _L["<Weibo@haimanman>"], x = nX + 10, y = 305, font = 27 }):Click(function()
OpenInternetExplorer("http://weibo.com/haimanman")
OpenInternetExplorer("https://weibo.com/haimanman")
end):Pos_()
end

Expand Down Expand Up @@ -312,5 +353,6 @@ local _About = {
OnPanelActive = _HM_About.PS.OnTaboxCheck,
GetAuthorInfo = _HM_About.PS.GetAuthorInfo,
SyncData = _HM_About.SyncData,
GetSyncData = _HM_About.GetSyncData,
}
setmetatable(HM_About, { __metatable = true, __index = _About, __newindex = function() end } )
23 changes: 6 additions & 17 deletions HM_AchieveWiki/HM_AchieveWiki.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- 海鳗插件:成就百科,源于菊花插件
--
local ACHI_ANCHOR = { s = "CENTER", r = "CENTER", x = 0, y = 0 }
local ACHI_ROOT_URL = "http://haimanchajian.com"
local ACHI_ROOT_URL = "https://haimanchajian.com"
local ACHI_CLIENT_LANG = select(3, GetVersion())
local Achievement = {}
local tinsert = table.insert
Expand Down Expand Up @@ -332,22 +332,11 @@ local function GetAchievementCode()
end

function Achievement.SyncUserData(fnCallBack, __qrcode)
local me = GetClientPlayer()
local nPoint = me.GetAchievementRecord()
HM.PostJson(ACHI_ROOT_URL .. "/api/wiki/data", {
gid = me.GetGlobalID(),
point = nPoint,
code = GetAchievementCode(),
name = GetUserRoleName(),
server = select(6, GetUserServer()),
school = me.dwForceID,
camp = me.nCamp,
body = me.nRoleType,
avatar = me.dwMiniAvatarID,
__qrcode = __qrcode,
__lang = ACHI_CLIENT_LANG,
}):done(function(res)
HM_AchieveWiki.nSyncPoint = nPoint
local data = HM_About.GetSyncData()
data.code = GetAchievementCode()
data.__qrcode = __qrcode
HM.PostJson(ACHI_ROOT_URL .. "/api/wiki/data", data):done(function(res)
HM_AchieveWiki.nSyncPoint = GetClientPlayer().GetAchievementRecord()
if fnCallBack then
fnCallBack(res)
end
Expand Down
40 changes: 16 additions & 24 deletions HM_Love/HM_Love.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ HM_Love.szTitle = _L["Lover of JX3"]
---------------------------------------------------------------------
-- 本地函数和变量
---------------------------------------------------------------------
local ROOT_URL = "http://haimanchajian.com"
local ROOT_URL = "https://haimanchajian.com"
local CLIENT_LANG = select(3, GetVersion())
local _i = Table_GetItemName
local _HM_Love = {
Expand Down Expand Up @@ -575,9 +575,9 @@ end
-- 删除远程情缘 (post used)
_HM_Love.DeleteRemote = function()
HM.PostJson(ROOT_URL .. "/api/data/lovers", {
gid = GetClientPlayer().GetGlobalID(),
__delete = 1,
__lang = CLIENT_LANG,
gid = GetClientPlayer().GetGlobalID(),
__delete = 1,
__lang = CLIENT_LANG,
})
end

Expand All @@ -588,26 +588,18 @@ _HM_Love.UploadRemote = function(__qrcode)
if not aInfo or not aCard then
return
end
HM.PostJson(ROOT_URL .. "/api/data/lovers", {
gid = me.GetGlobalID(),
lover = HM.JsonEncode({
dwID = aInfo.id,
szName = aInfo.name,
dwAvatar = aCard.dwMiniAvatarID,
nRoletype = aCard.nRoleType,
dwForceID = aCard.dwForceID,
nLoveType = _HM_Love.nLoveType,
nStartTime = _HM_Love.nStartTime,
}),
name = GetUserRoleName(),
server = select(6, GetUserServer()),
school = me.dwForceID,
camp = me.nCamp,
body = me.nRoleType,
avatar = me.dwMiniAvatarID,
__qrcode = __qrcode or "0",
__lang = CLIENT_LANG,
}):done(function(res)
local data = HM_About.GetSyncData()
data.lover = HM.JsonEncode({
dwID = aInfo.id,
szName = aInfo.name,
dwAvatar = aCard.dwMiniAvatarID,
nRoletype = aCard.nRoleType,
dwForceID = aCard.dwForceID,
nLoveType = _HM_Love.nLoveType,
nStartTime = _HM_Love.nStartTime,
})
data.__qrcode = __qrcode or "0"
HM.PostJson(ROOT_URL .. "/api/data/lovers", data):done(function(res)
if not res or res.errcode ~= 0 then
HM.Alert(res.errmsg)
elseif res.qrcode then
Expand Down
60 changes: 57 additions & 3 deletions HM_Secret/HM_Secret.lua
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ end
-------------------------------------
-- 事件处理
-------------------------------------
local ROOT_URL = "https://haimanchajian.com"
local CLIENT_LANG = select(3, GetVersion())

-------------------------------------
-- 设置界面
Expand All @@ -457,11 +459,63 @@ _HM_Secret.PS.OnPanelActive = function(frame)
--nX = ui:Append("WndButton", { x = 0, y = 0, txt = "刷新列表" }):Click(_HM_Secret.LoadList):Pos_()
--nX = ui:Append("WndButton", { x = nX, y = 0, txt = "发布秘密" }):Click(_HM_Secret.PostNew):Pos_()
-- Tips
ui:Append("Text", { x = nX + 10, y = 0, txt = "这不是树洞,秘密就来自你身边的朋友。", font = 27 })
ui:Append("Text", { x = 0, y = 0, txt = "不只是树洞,秘密就来自你身边的玩家,请微信扫码访问!", font = 27 })
ui:Append("Text", { x = 0, y = 378, txt = "小提示:包括插件作者在内任何人都无法知道秘密的来源,请放心发布。", font = 47 })
-- tips
ui:Append("Text", { x = 10, y = 28, w = 486, h = 50, multi = true, txt = "秘密/Secret 功能已转移到微信公众号,扫描下图的二维码或微信搜索”海鳗插件“并关注即可。", font = 207 })
ui:Append("Image", { x = 0, y = 82, w = 532, h = 168 }):File("interface\\HM\\HM_0Base\\image.UITEX", 0)
ui:Append("Image", "Image_Wechat", { x = 0, y = 36, w = 150, h = 150 }):File("interface\\HM\\HM_0Base\\image.UiTex", 2)
-- verify
ui:Append("Text", { x = 0, y = 214, txt = "海鳗插件认证", font = 8 })
ui:Append("Text", "Text_Verify", { x = 3, y = 242, txt = "loading...", font = 47 })
nX = ui:Append("Text", { x= 3, y = 276, txt = "认证选项:" }):Pos_()
nX = ui:Append("WndCheckBox", "Check_Basic", { x = nX, y = 276, txt = "区服体型", checked = true, enable = false }):Pos_()
nX = ui:Append("WndCheckBox", "Check_Name", { x = nX + 10, y = 276, txt = "角色名", checked = true }):Pos_()
nX = ui:Append("WndCheckBox", "Check_Equip", { x = nX + 10, y = 276, txt = "武器&坐骑", checked = true }):Pos_()
nX = ui:Append("WndButton", "Btn_Delete", { x = 0, y = 312, txt = "解除认证", enable = false }):Click(function()
HM.Confirm("确定要解除认证吗?", function()
local data = {}
data.gid = GetClientPlayer().GetGlobalID()
data.isOpenVerify = "0"
HM.PostJson(ROOT_URL .. "/api/data/roles", data):done(function(res)
HM.OpenPanel(_HM_Secret.szName)
end)
end)
end):Pos_()
nX = ui:Append("WndButton", "Btn_Submit", { x = nX + 10, y = 312, txt = "立即认证" }):Click(function()
local btn = ui:Fetch("Btn_Submit")
local data = HM_About.GetSyncData()
data.isOpenName = ui:Fetch("Check_Name"):Check() and 1 or 0
data.isOpenEquip = ui:Fetch("Check_Equip"):Check() and 1 or 0
data.__qrcode = "1"
btn:Enable(false)
HM.PostJson(ROOT_URL .. "/api/data/roles", data):done(function(res)
if res and res.qrcode then
local w, h = 240, 240
local frm = HM.UI.CreateFrame("HM_ImageView", { w = w + 90, h = h + 90 + 20, bgcolor = {222, 210, 190, 240}, title = _L["Scan by wechat"], close = true })
frm:Append("Image", { x = 0, y = 0, w = w, h = h }):Raw():FromRemoteFile(res.qrcode:gsub("https:", "http:"), true)
frm:Append("Text", { x = 0, y = h + 10, w = w, h = 36, align = 1, font = 6, txt = "微信扫码完成认证" })
frm:Raw():GetRoot():SetPoint("CENTER", 0, 0, "CENTER", 0, 0)
ui:Fetch("Image_Wechat"):Toggle(false)
end
btn:Text("重新认证")
btn:Enable(true)
ui:Fetch("Text_Verify"):Text("扫码后请点击左侧菜单刷新")
end)
end):Pos_()
-- /api/data/roles/{gid}
HM.GetJson(ROOT_URL .. "/api/data/roles/" .. GetClientPlayer().GetGlobalID()):done(function(res)
if res.verify then
local szText = res.verify .. " (" .. FormatTime("%Y/%m/%d %H:%M", res.time_update) .. ")"
ui:Fetch("Text_Verify"):Text(szText)
ui:Fetch("Check_Name"):Check(res.open_name == true)
ui:Fetch("Check_Equip"):Check(res.open_equip == true)
ui:Fetch("Btn_Delete"):Enable(true)
ui:Fetch("Btn_Submit"):Text("重新认证")
else
ui:Fetch("Text_Verify"):Text(res.errmsg or "<未认证>"):Color(255, 0, 0)
end
end):fail(function()
ui:Fetch("Text_Verify"):Text(_L["Request failed"]):Color(255, 0, 0)
end)
do return end
--[[
-- table frame
Expand Down

0 comments on commit 4bcd7a3

Please sign in to comment.