695 lines
25 KiB
Plaintext
695 lines
25 KiB
Plaintext
|
|
/*
|
||
|
|
文件名:TH_CombatRank.nut
|
||
|
|
路径:Project/TH_CombatRank/TH_CombatRank.nut
|
||
|
|
创建日期:2025-07-01 10:18
|
||
|
|
文件用途:战力排行榜
|
||
|
|
*/
|
||
|
|
class TH_CombatRankC extends LenheartNewUI_Windows {
|
||
|
|
//调试模式
|
||
|
|
// DeBugMode = true;
|
||
|
|
|
||
|
|
//不是窗口
|
||
|
|
// NoWindow = true;
|
||
|
|
|
||
|
|
//是否可见
|
||
|
|
Visible = false;
|
||
|
|
|
||
|
|
Img = null;
|
||
|
|
|
||
|
|
|
||
|
|
TitleButtonList = null;
|
||
|
|
|
||
|
|
//个人 公会
|
||
|
|
Page = 0;
|
||
|
|
|
||
|
|
Test = null;
|
||
|
|
|
||
|
|
//个人战力集合
|
||
|
|
CombatInfoList = null;
|
||
|
|
//个人奖励集合
|
||
|
|
PersonReward = null;
|
||
|
|
//查看中的详细个人信息
|
||
|
|
LookingInfo = null;
|
||
|
|
|
||
|
|
//我的战力
|
||
|
|
MyCombat = null;
|
||
|
|
|
||
|
|
//宣言Timer
|
||
|
|
DeclareTimer = null;
|
||
|
|
DeclareFlag = false;
|
||
|
|
|
||
|
|
//公会奖励集合
|
||
|
|
GuildReward = null;
|
||
|
|
GuildFlagData = null;
|
||
|
|
GuildFlagImgMap = null;
|
||
|
|
//公会战力集合
|
||
|
|
GuildInfoList = null;
|
||
|
|
|
||
|
|
//滚动条
|
||
|
|
ScrollBar = null;
|
||
|
|
ScrollBarRate = 0;
|
||
|
|
ScrollBarValue = 1804;
|
||
|
|
|
||
|
|
function CheckPersonalCombatPower() {
|
||
|
|
SendPackEx({
|
||
|
|
op = 20096003
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
function CheckGuildCombatPower() {
|
||
|
|
SendPackEx({
|
||
|
|
op = 20096005
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||
|
|
DeclareTimer = Clock();
|
||
|
|
Childrens = [];
|
||
|
|
TitleButtonList = [];
|
||
|
|
//注册控件
|
||
|
|
RegisterWidget();
|
||
|
|
|
||
|
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||
|
|
|
||
|
|
|
||
|
|
Img = {};
|
||
|
|
Img["main"] <- Rindro_Image("interface/rindro/hmnew_rank.img");
|
||
|
|
Img["information_button_cn"] <- Rindro_Image("interface2/hud/information_button/information_button_cn.img");
|
||
|
|
Img["newuserinfo"] <- Rindro_Image("interface/userinfomation/newuserinfo.img");
|
||
|
|
|
||
|
|
//基础配置数据回包
|
||
|
|
RegisterPack(20096102, function(Chunk) {
|
||
|
|
local Jso = Json.Decode(Chunk);
|
||
|
|
PersonReward = Jso["config"];
|
||
|
|
}.bindenv(this));
|
||
|
|
|
||
|
|
//基础公会数据回包
|
||
|
|
RegisterPack(20096104, function(Chunk) {
|
||
|
|
local Jso = Json.Decode(Chunk);
|
||
|
|
GuildReward = Jso["config"];
|
||
|
|
GuildFlagData = {};
|
||
|
|
GuildFlagImgMap = {};
|
||
|
|
foreach(object in Jso["config2"]) {
|
||
|
|
GuildFlagData.rawset(object.guildId, [object.img, object.imgid]);
|
||
|
|
}
|
||
|
|
}.bindenv(this));
|
||
|
|
|
||
|
|
//查询个人战力排行榜包
|
||
|
|
RegisterPack(20096004, function(Chunk) {
|
||
|
|
local Jso = Json.Decode(Chunk);
|
||
|
|
local ranking = Jso.ranking;
|
||
|
|
|
||
|
|
CombatInfoList = [];
|
||
|
|
foreach(Pos, Info in ranking) {
|
||
|
|
//补全默认公会
|
||
|
|
if (!Info.rawin("guildname")) Info.guildname <- "无公会";
|
||
|
|
//构造显示对象
|
||
|
|
local Buf = TH_CombatRankC_Item(this, Pos, Info, 0);
|
||
|
|
CombatInfoList.append(Buf);
|
||
|
|
}
|
||
|
|
|
||
|
|
// LookingInfo = CombatInfoList[0];
|
||
|
|
|
||
|
|
//构造我自己
|
||
|
|
if (!Jso.my.rawin("guildname")) Jso.my.guildname <- "无公会";
|
||
|
|
MyCombat = TH_CombatRankC_Item(this, 900, Jso.my, 0);
|
||
|
|
MyCombat.Idx = Jso.on - 1;
|
||
|
|
}.bindenv(this));
|
||
|
|
|
||
|
|
RegisterPack(20096006, function(Chunk) {
|
||
|
|
local Jso = Json.Decode(Chunk);
|
||
|
|
local ranking = Jso.ranking;
|
||
|
|
GuildInfoList = [];
|
||
|
|
foreach(Pos, Info in ranking) {
|
||
|
|
local Buf = TH_CombatRankC_Item(this, Pos, Info, 1);
|
||
|
|
GuildInfoList.append(Buf);
|
||
|
|
}
|
||
|
|
}.bindenv(this));
|
||
|
|
|
||
|
|
CheckPersonalCombatPower();
|
||
|
|
CheckGuildCombatPower();
|
||
|
|
|
||
|
|
UploadYourOwnCombatPower();
|
||
|
|
}
|
||
|
|
|
||
|
|
function RegisterWidget() {
|
||
|
|
//返回按钮
|
||
|
|
local ReturnButton = LenheartNewUI_BaseButton(8, 8, 11, 12, "interface/lenheartwindowcommon.img", 540);
|
||
|
|
ReturnButton.OnClick = function() {
|
||
|
|
LookingInfo = null;
|
||
|
|
}.bindenv(this);
|
||
|
|
Childrens.append(ReturnButton);
|
||
|
|
|
||
|
|
//关闭按钮
|
||
|
|
local CloseButton = LenheartNewUI_BaseButton(722, 8, 11, 12, "interface/lenheartwindowcommon.img", 276);
|
||
|
|
CloseButton.OnClick = function() {
|
||
|
|
this.Visible = false;
|
||
|
|
}.bindenv(this);
|
||
|
|
Childrens.append(CloseButton);
|
||
|
|
|
||
|
|
local WorshipButton = LenheartNewUI_ButtonText(630, 240, 45, "膜 拜");
|
||
|
|
WorshipButton.SetTextOffset(13, 1);
|
||
|
|
WorshipButton.OnClick = function() {
|
||
|
|
if (LookingInfo) {
|
||
|
|
SendPackEx({
|
||
|
|
op = 20096007,
|
||
|
|
mbcid = LookingInfo.Info.cid
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}.bindenv(this);
|
||
|
|
WorshipButton.SetCallBackFunc(function(Btn) {
|
||
|
|
if (LookingInfo == null) {
|
||
|
|
Btn.Visible = false;
|
||
|
|
} else {
|
||
|
|
Btn.Visible = true;
|
||
|
|
}
|
||
|
|
}.bindenv(this));
|
||
|
|
AddChild(WorshipButton);
|
||
|
|
|
||
|
|
// local FuncTabbar1 = LenheartNewUI_TabbarsText(4, 23, "巅峰战力");
|
||
|
|
// FuncTabbar1.State = 1;
|
||
|
|
// FuncTabbar1.SetTextOffset(8, 4);
|
||
|
|
// AddChild(FuncTabbar1);
|
||
|
|
// FuncTabbar1.OnClick = function() {
|
||
|
|
// TitleButtonList[1].State = 0;
|
||
|
|
// TitleButtonList[0].State = 1;
|
||
|
|
// TitleButtonList[2].State = 0;
|
||
|
|
// Page = 0;
|
||
|
|
// LookingInfo = null;
|
||
|
|
// ScrollBar.Reset();
|
||
|
|
// }.bindenv(this);
|
||
|
|
// TitleButtonList.append(FuncTabbar1);
|
||
|
|
|
||
|
|
// local FuncTabbar2 = LenheartNewUI_TabbarsText(65, 23, "公会战力");
|
||
|
|
// FuncTabbar2.SetTextOffset(8, 4);
|
||
|
|
// AddChild(FuncTabbar2);
|
||
|
|
// FuncTabbar2.OnClick = function() {
|
||
|
|
// TitleButtonList[0].State = 0;
|
||
|
|
// TitleButtonList[1].State = 1;
|
||
|
|
// TitleButtonList[2].State = 0;
|
||
|
|
// Page = 1;
|
||
|
|
// LookingInfo = null;
|
||
|
|
// ScrollBar.Reset();
|
||
|
|
// }.bindenv(this);
|
||
|
|
// TitleButtonList.append(FuncTabbar2);
|
||
|
|
|
||
|
|
// local FuncTabbar3 = LenheartNewUI_TabbarsText(476, 23, "我的战力");
|
||
|
|
// FuncTabbar3.SetTextOffset(8, 4);
|
||
|
|
// AddChild(FuncTabbar3);
|
||
|
|
// FuncTabbar3.OnClick = function() {
|
||
|
|
// TitleButtonList[0].State = 0;
|
||
|
|
// TitleButtonList[1].State = 0;
|
||
|
|
// TitleButtonList[2].State = 1;
|
||
|
|
// Page = 0;
|
||
|
|
// LookingInfo = MyCombat;
|
||
|
|
// ScrollBar.Reset();
|
||
|
|
// }.bindenv(this);
|
||
|
|
// TitleButtonList.append(FuncTabbar3);
|
||
|
|
|
||
|
|
ScrollBar = Yosin_ScrollBar(729, 295, 218, 60);
|
||
|
|
ScrollBar.SetParent(this);
|
||
|
|
ScrollBar.SetStep(20 / 100.0);
|
||
|
|
ScrollBar.SetOnChange(function(Rate) {
|
||
|
|
ScrollBarRate = Rate;
|
||
|
|
}.bindenv(this));
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
//绘制主界面
|
||
|
|
function DrawMain(obj) {
|
||
|
|
Img["main"].DrawPng(0, X, Y);
|
||
|
|
Img["main"].DrawPng(0, X, Y);
|
||
|
|
// Img["main"].DrawPng(0, X, Y);
|
||
|
|
|
||
|
|
L_sq_DrawCode("荣誉殿堂", X + 347, Y + 8, sq_RGBA(255, 177, 0, 255), 0, 1);
|
||
|
|
Img["information_button_cn"].DrawPng(136, X + 14, Y + 274);
|
||
|
|
|
||
|
|
if (Page == 0) {
|
||
|
|
//职业
|
||
|
|
L_sq_DrawCode("角色名", X + 90, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
L_sq_DrawCode("膜拜次数", X + 189, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
L_sq_DrawCode("职业", X + 282, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
L_sq_DrawCode("公会名", X + 378, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
L_sq_DrawCode("战斗力", X + 497, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
L_sq_DrawCode("奖励", X + 644, Y + 278, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
|
||
|
|
|
||
|
|
setClip(X + 2, Y + 294, X + 729, Y + 294 + 218);
|
||
|
|
if (CombatInfoList) {
|
||
|
|
foreach(Pos, Object in CombatInfoList) {
|
||
|
|
Object.Show(X, Y + 294 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
releaseClip(); //裁切结束
|
||
|
|
|
||
|
|
//绘制前三名
|
||
|
|
if (CombatInfoList) {
|
||
|
|
for (local i = 0; i< 3; i++) {
|
||
|
|
//如果不足3个
|
||
|
|
if (i >= CombatInfoList.len()) break;
|
||
|
|
|
||
|
|
local OffsetX = 370;
|
||
|
|
local OffsetY = 220;
|
||
|
|
if (i == 1) {
|
||
|
|
OffsetX = 178;
|
||
|
|
}
|
||
|
|
if (i == 2) {
|
||
|
|
OffsetX = 565;
|
||
|
|
}
|
||
|
|
if (!LookingInfo || LookingInfo.Idx != i) {
|
||
|
|
CombatInfoList[i].ShowCharacter(X + OffsetX, Y + OffsetY);
|
||
|
|
local name = CombatInfoList[i].Info.name;
|
||
|
|
L_sq_DrawCode(name, X + OffsetX + 5 - LenheartTextClass.GetStringLength(name) / 2, Y + OffsetY + 25, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
|
||
|
|
if (Clock() - DeclareTimer >= 3000) {
|
||
|
|
DeclareTimer = Clock();
|
||
|
|
DeclareFlag = !DeclareFlag;
|
||
|
|
}
|
||
|
|
if (DeclareFlag) {
|
||
|
|
local gg = CombatInfoList[i].Info.zdygg;
|
||
|
|
if (gg.len() == 0) gg = "暂无宣言!";
|
||
|
|
Img["main"].DrawPng(9 + i, X + OffsetX - 66, Y + OffsetY - 194);
|
||
|
|
L_sq_DrawCode_Ex(gg, X + OffsetX - 56, Y + OffsetY - 176, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//如果有查看者
|
||
|
|
if (LookingInfo) {
|
||
|
|
Img["main"].DrawPng(7, X + 2, Y + 24);
|
||
|
|
T_DrawDynamicAni(obj, "ui/selectcharacter/animation/selectcharactereffect.ani", X + 15, Y + 30, "桃花战斗力角色背景光环");
|
||
|
|
Img["main"].DrawPng(8, X + 30, Y + 140);
|
||
|
|
// LookingInfo.CharacShow.Draw(X + 80, Y + 248);
|
||
|
|
LookingInfo.ShowCharacter(X + 80, Y + 228);
|
||
|
|
|
||
|
|
local YPosBuffer = Y - 25;
|
||
|
|
//排名
|
||
|
|
L_sq_DrawCode("排名: " + (LookingInfo.Idx + 1), X + 150, YPosBuffer + 60, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
//角色名
|
||
|
|
L_sq_DrawCode("角色名: " + LookingInfo.Info.name, X + 150, YPosBuffer + 78, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
//职业
|
||
|
|
L_sq_DrawCode("角色职业: " + LookingInfo.Info.jobname, X + 150, YPosBuffer + 96, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
//等级
|
||
|
|
L_sq_DrawCode("角色等级: " + LookingInfo.Info.level, X + 150, YPosBuffer + 114, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
//公会名
|
||
|
|
L_sq_DrawCode("所属公会: " + LookingInfo.Info.guildname, X + 150, YPosBuffer + 132, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
//是否在线
|
||
|
|
L_sq_DrawCode("当前状态: " + (LookingInfo.Info.isOnline ? "在线" : "离线"), X + 150, YPosBuffer + 150, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
|
||
|
|
//战斗力
|
||
|
|
L_sq_DrawCode("战斗力: " + LookingInfo.Info.zdlS, X + 150, YPosBuffer + 168, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
L_sq_DrawCode("-- 基础战斗力: " + LookingInfo.Info.jczdlS, X + 150, YPosBuffer + 186, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
L_sq_DrawCode(" 四维: " + LookingInfo.Info.swzldS, X + 150, YPosBuffer + 204, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
L_sq_DrawCode(" 三攻: " + LookingInfo.Info.sgzldS, X + 150, YPosBuffer + 222, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
L_sq_DrawCode(" 属强: " + LookingInfo.Info.sqzldS, X + 150, YPosBuffer + 240, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
L_sq_DrawCode(" 其他: " + LookingInfo.Info.qtzldS, X + 150, YPosBuffer + 258, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
|
||
|
|
L_sq_DrawCode("-- 膜拜次数: " + LookingInfo.Info.fstS, X + 150, YPosBuffer + 276, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
if (Page == 1) {
|
||
|
|
//职业
|
||
|
|
L_sq_DrawCode("会长", X + 58, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
//角色名
|
||
|
|
L_sq_DrawCode("公会名称", X + 152, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
//公会名
|
||
|
|
L_sq_DrawCode("战斗力", X + 280, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
//战斗力
|
||
|
|
L_sq_DrawCode(" 奖励", X + 438, Y + 299, sq_RGBA(179, 169, 135, 255), 0, 1);
|
||
|
|
|
||
|
|
setClip(X, Y + 316, X + 528, Y + 316 + 196);
|
||
|
|
if (GuildInfoList) {
|
||
|
|
foreach(Pos, Object in GuildInfoList) {
|
||
|
|
Object.Show(X, Y + 316 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
releaseClip(); //裁切结束
|
||
|
|
|
||
|
|
if (GuildInfoList) {
|
||
|
|
for (local i = 0; i< 3; i++) {
|
||
|
|
if (GuildInfoList.len() <= i) break;
|
||
|
|
|
||
|
|
local OffsetX = 270;
|
||
|
|
local OffsetY = 268;
|
||
|
|
if (i == 1) {
|
||
|
|
OffsetX = 130;
|
||
|
|
OffsetY = 268;
|
||
|
|
}
|
||
|
|
if (i == 2) {
|
||
|
|
OffsetX = 410;
|
||
|
|
OffsetY = 268;
|
||
|
|
}
|
||
|
|
|
||
|
|
local Object = GuildInfoList[i];
|
||
|
|
local GuildId = Object.Info.guildId;
|
||
|
|
if (GuildFlagData.rawin(GuildId)) {
|
||
|
|
local Info = GuildFlagData[GuildId];
|
||
|
|
if (!GuildFlagImgMap.rawin(Info[0])) {
|
||
|
|
GuildFlagImgMap[Info[0]] <- Rindro_Image(Info[0]);
|
||
|
|
}
|
||
|
|
GuildFlagImgMap[Info[0]].DrawPng(0, X + OffsetX, Y + OffsetY);
|
||
|
|
} else {
|
||
|
|
Img["main"].DrawPng(3, X + OffsetX, Y + OffsetY);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
function Show(obj) {
|
||
|
|
DrawMain(obj);
|
||
|
|
LenheartNewUI_Windows.Show(obj);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
function TopShow(obj) {
|
||
|
|
LenheartNewUI_Windows.TopShow(obj);
|
||
|
|
local MousePos_X = IMouse.GetXPos();
|
||
|
|
local MousePos_Y = IMouse.GetYPos();
|
||
|
|
|
||
|
|
if (CombatInfoList && Page == 0) {
|
||
|
|
setClip(X + 2, Y + 294, X + 729, Y + 294 + 218);
|
||
|
|
foreach(Pos, Object in CombatInfoList) {
|
||
|
|
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y + 294 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger(), 726, 39)) {
|
||
|
|
Object.HoverShow(X, Y + 294 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
releaseClip(); //裁切结束
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function DrawItemBase(X, Ypos, Id, Count) {
|
||
|
|
if ((Ypos + 28) > this.Y + 294 && Ypos< this.Y + 294 + 218) {
|
||
|
|
LenheartNewUI_Windows.DrawItemBase(X, Ypos, Id, Count);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//鼠标滚轮事件回调
|
||
|
|
function OnMouseWheel(Flag, MousePos_X, MousePos_Y) {
|
||
|
|
LenheartNewUI_BaseWindow.OnMouseWheel(Flag, MousePos_X, MousePos_Y);
|
||
|
|
//左侧的滚动条判定
|
||
|
|
if (MousePos_X > X && MousePos_X<(X + 726) && MousePos_Y > (Y + 294) && MousePos_Y<(Y + 294 + 218)) {
|
||
|
|
if (Flag) ScrollBar.DoStep(-1);
|
||
|
|
if (!Flag) ScrollBar.DoStep(1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//鼠标左键按下回调
|
||
|
|
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||
|
|
LenheartNewUI_BaseWindow.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||
|
|
if (CombatInfoList) {
|
||
|
|
foreach(Pos, Object in CombatInfoList) {
|
||
|
|
if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y + 294 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger(), 726, 39)) {
|
||
|
|
Object.OnMouseLbDown(X, Y + 294 + (Pos * 40) - (ScrollBarRate * ScrollBarValue).tointeger());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//逻辑入口
|
||
|
|
function Proc(obj) {
|
||
|
|
LenheartNewUI_Windows.SyncPos(X, Y);
|
||
|
|
}
|
||
|
|
|
||
|
|
//上传自身战斗力
|
||
|
|
//时装 帽子 头部 脸 上衣 下装 鞋子 胸部 腰部 皮肤 光环
|
||
|
|
// AvatarInfoIdx = [0x3038, 0x3010, 0x3014, 0x3018, 0x301c, 0x3020, 0x3024, 0x3028, 0x302c, 0x3034];
|
||
|
|
AvatarInfoIdx = [0x3038, 0x3010, 0x3014, 0x3018, 0x301c, 0x3020, 0x3024, 0x3028, 0x302c, 0x3030, 0x3034];
|
||
|
|
creInfoIdx = [0x3068, 0x306C, 0x3070, 0x3074];
|
||
|
|
|
||
|
|
function UploadYourOwnCombatPower() {
|
||
|
|
if (sq_GetCurrentModuleType() != 1) return;
|
||
|
|
local obj = sq_GetMyMasterCharacter();
|
||
|
|
if (!obj) return;
|
||
|
|
local C_Object = L_sq_RA(0x1ab7cdc);
|
||
|
|
//记录时装
|
||
|
|
local avataritemsbuf = [];
|
||
|
|
foreach(offset in AvatarInfoIdx) {
|
||
|
|
local AvatarEquiAddress = L_sq_RA(C_Object + offset);
|
||
|
|
if (AvatarEquiAddress >= 0x400000) {
|
||
|
|
local Ab = [];
|
||
|
|
local NormalIndex = L_sq_RA(AvatarEquiAddress + 0x1c);
|
||
|
|
local ExIndex = L_sq_RA(AvatarEquiAddress + 0x13E0);
|
||
|
|
Ab.append(NormalIndex);
|
||
|
|
Ab.append(ExIndex);
|
||
|
|
avataritemsbuf.append(Ab);
|
||
|
|
} else {
|
||
|
|
local Ab = [];
|
||
|
|
Ab.append(0);
|
||
|
|
Ab.append(0);
|
||
|
|
avataritemsbuf.append(Ab);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
//记录装备
|
||
|
|
local equiitemsbuf = [];
|
||
|
|
local equiupbuf = [];
|
||
|
|
for (local i = 1; i< 13; ++i) {
|
||
|
|
//编号
|
||
|
|
local Index = L_sq_GetCharacterAttribute(0x1c, i);
|
||
|
|
//强化
|
||
|
|
local Upvalue = L_sq_GetCharacterAttribute(0x1054, i)
|
||
|
|
//是否有增幅属性
|
||
|
|
local IsZf = L_sq_GetCharacterAttribute(0x10A8, i)
|
||
|
|
//锻造
|
||
|
|
local DsUpvalue = L_sq_GetCharacterAttribute(0x10E8, i);
|
||
|
|
//附魔卡片
|
||
|
|
local Enchanting = L_sq_GetCharacterAttribute(0x1084, i);
|
||
|
|
|
||
|
|
equiitemsbuf.append(Index);
|
||
|
|
|
||
|
|
local Info = [];
|
||
|
|
if (IsZf) {
|
||
|
|
Info.append(0);
|
||
|
|
Info.append(Upvalue);
|
||
|
|
} else {
|
||
|
|
Info.append(Upvalue);
|
||
|
|
Info.append(0);
|
||
|
|
}
|
||
|
|
Info.append(DsUpvalue);
|
||
|
|
Info.append(Enchanting);
|
||
|
|
equiupbuf.append(Info);
|
||
|
|
|
||
|
|
}
|
||
|
|
//记录宠物
|
||
|
|
local creitemsbuf = [];
|
||
|
|
foreach(offset in creInfoIdx) {
|
||
|
|
local creEquiAddress = L_sq_RA(C_Object + offset);
|
||
|
|
if (creEquiAddress >= 0x400000) {
|
||
|
|
local NormalIndex = L_sq_RA(creEquiAddress + 0x1c);
|
||
|
|
creitemsbuf.append(NormalIndex);
|
||
|
|
} else {
|
||
|
|
creitemsbuf.append(0);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//记录四维三攻属强
|
||
|
|
local Attributes = 0;
|
||
|
|
Attributes += L_sq_GetCharacterAttribute(0x2364);
|
||
|
|
Attributes += L_sq_GetCharacterAttribute(0x2394);
|
||
|
|
Attributes += L_sq_GetCharacterAttribute(0x237c);
|
||
|
|
Attributes += L_sq_GetCharacterAttribute(0x23ac);
|
||
|
|
|
||
|
|
|
||
|
|
local AttackValue = 0;
|
||
|
|
AttackValue += L_sq_GetCharacterAttribute(0x1E54);
|
||
|
|
AttackValue += L_sq_GetCharacterAttribute(0x1E84);
|
||
|
|
AttackValue += L_sq_GetCharacterAttribute(0x22C8);
|
||
|
|
|
||
|
|
local Enhancement = 0; //火冰光暗
|
||
|
|
Enhancement += L_sq_GetCharacterAttribute(0x1b54);
|
||
|
|
Enhancement += L_sq_GetCharacterAttribute(0x1b60);
|
||
|
|
Enhancement += L_sq_GetCharacterAttribute(0x1b78);
|
||
|
|
Enhancement += L_sq_GetCharacterAttribute(0x1b6c);
|
||
|
|
|
||
|
|
local T = {
|
||
|
|
op = 20096001,
|
||
|
|
ava = avataritemsbuf,
|
||
|
|
equ = equiitemsbuf,
|
||
|
|
sw = Attributes,
|
||
|
|
atk = AttackValue,
|
||
|
|
ele = Enhancement,
|
||
|
|
cre = creitemsbuf,
|
||
|
|
job = sq_getJob(obj),
|
||
|
|
exjob = sq_getGrowType(obj),
|
||
|
|
name = L_Sq_GetObjectName(obj),
|
||
|
|
equUp = equiupbuf,
|
||
|
|
fst = 0,
|
||
|
|
}
|
||
|
|
SendPackEx(T);
|
||
|
|
}
|
||
|
|
|
||
|
|
function OpenCallBack() {
|
||
|
|
UploadYourOwnCombatPower();
|
||
|
|
CheckPersonalCombatPower();
|
||
|
|
CheckGuildCombatPower();
|
||
|
|
LookingInfo = null;
|
||
|
|
this.Visible = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
//高级绘制文字(带换行)
|
||
|
|
function L_sq_DrawCode_Ex(str, x, y, rgba, mb, jc) {
|
||
|
|
local strarr = [];
|
||
|
|
if (str.find("\\n") == null) L_sq_DrawCode(str, x, y, rgba, mb, jc);
|
||
|
|
else {
|
||
|
|
local Bpos = 0;
|
||
|
|
while (true) {
|
||
|
|
local Npos = str.find("\\n", Bpos);
|
||
|
|
if (!Npos) {
|
||
|
|
local strbuff = str.slice(Bpos, str.len());
|
||
|
|
strarr.append(strbuff);
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
local strbuff = str.slice(Bpos, Npos);
|
||
|
|
strarr.append(strbuff);
|
||
|
|
Bpos = Npos + 2;
|
||
|
|
}
|
||
|
|
for (local z = 0; z< strarr.len(); z++) {
|
||
|
|
L_sq_DrawCode(strarr[z], x, y + (z * 14), rgba, mb, jc);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
L_Windows_List <- [];
|
||
|
|
getroottable().rawdelete("LenheartPluginsInitFlag");
|
||
|
|
getroottable().rawdelete("EventList_Obj")
|
||
|
|
getroottable().rawdelete("TH_CombatRank_Obj");
|
||
|
|
|
||
|
|
function Lenheart_TH_CombatRank_Fun(obj) {
|
||
|
|
local RootTab = getroottable();
|
||
|
|
if (!RootTab.rawin("TH_CombatRank_Obj")) {
|
||
|
|
RootTab.rawset("TH_CombatRank_Obj", true);
|
||
|
|
local Win = LenheartNewUI_CreateWindow(TH_CombatRankC, "桃花定制战力榜窗口", ((getroottable().Rindro_Scr_Width - 742) / 2).tointeger(), 28, 742, 515, 24);
|
||
|
|
EventList_Obj.AddEvent("全服战力榜", 694, Win, "interface2/hud/information_button/information_button_cn.img");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
getroottable()["LenheartFuncTab"].rawset("TH_CombatRankFuncN", Lenheart_TH_CombatRank_Fun);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
class TH_CombatRankC_Item {
|
||
|
|
|
||
|
|
//Img
|
||
|
|
Img = null;
|
||
|
|
//编号
|
||
|
|
Idx = null;
|
||
|
|
//父对象
|
||
|
|
Parent = null;
|
||
|
|
//显示角色
|
||
|
|
CharacShow = null;
|
||
|
|
|
||
|
|
//信息体
|
||
|
|
Info = null;
|
||
|
|
//类型
|
||
|
|
Type = 0;
|
||
|
|
|
||
|
|
constructor(Window, Idx, Info, Type) {
|
||
|
|
Parent = Window;
|
||
|
|
Img = Window.Img["main"];
|
||
|
|
this.Idx = Idx;
|
||
|
|
this.Info = Info;
|
||
|
|
this.Type = Type;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
function Show(X, Y) {
|
||
|
|
|
||
|
|
if (Idx< 3) {
|
||
|
|
Img.DrawPng(4 + Idx, X + 3, Y);
|
||
|
|
} else {
|
||
|
|
Img.DrawPng(1, X + 3, Y);
|
||
|
|
}
|
||
|
|
|
||
|
|
local Ranking = (Idx + 1).tostring();
|
||
|
|
|
||
|
|
local JobName;
|
||
|
|
local CharacName;
|
||
|
|
local Combat;
|
||
|
|
local MbCount;
|
||
|
|
local GuildName;
|
||
|
|
|
||
|
|
if (this.Type == 0) {
|
||
|
|
JobName = Info.jobname;
|
||
|
|
CharacName = Info.name;
|
||
|
|
Combat = Info.zdlS;
|
||
|
|
MbCount = Info.mbcs.tostring();
|
||
|
|
GuildName = Info.guildname;
|
||
|
|
} else if (this.Type == 1) {
|
||
|
|
JobName = Info.guildMaster;
|
||
|
|
CharacName = Info.guildName;
|
||
|
|
Combat = Info.zdlS;
|
||
|
|
}
|
||
|
|
|
||
|
|
//绘制排名
|
||
|
|
L_sq_DrawCode(Ranking, X + 25 - LenheartTextClass.GetStringLength(Ranking) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
//绘制角色名
|
||
|
|
L_sq_DrawCode(CharacName, X + 110 - LenheartTextClass.GetStringLength(CharacName) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
//绘制膜拜次数
|
||
|
|
L_sq_DrawCode(MbCount, X + 213 - LenheartTextClass.GetStringLength(MbCount) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
//绘制职业
|
||
|
|
L_sq_DrawCode(JobName, X + 297 - LenheartTextClass.GetStringLength(JobName) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
//绘制公会名
|
||
|
|
L_sq_DrawCode(GuildName, X + 398 - LenheartTextClass.GetStringLength(GuildName) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
//绘制战斗力
|
||
|
|
L_sq_DrawCode(Combat, X + 517 - LenheartTextClass.GetStringLength(Combat) / 2, Y + 14, sq_RGBA(230, 200, 155, 255), 0, 1);
|
||
|
|
|
||
|
|
//绘制奖励
|
||
|
|
if (this.Type == 0) {
|
||
|
|
if (Parent.PersonReward) {
|
||
|
|
if(Idx >= Parent.PersonReward.len())return;
|
||
|
|
local Reward = Parent.PersonReward[Idx];
|
||
|
|
foreach(Pos, ItemInfo in Reward) {
|
||
|
|
Parent.DrawItemBase(X + 377 + 200 + (Pos * 30), Y + 4, ItemInfo[0], ItemInfo[1]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
} else if (this.Type == 1) {
|
||
|
|
if (Parent.PersonReward) {
|
||
|
|
local Reward = Parent.PersonReward[Idx];
|
||
|
|
foreach(Pos, ItemInfo in Reward) {
|
||
|
|
Parent.DrawItemBase(X + 377 + 200 + (Pos * 30), Y + 4, ItemInfo[0], ItemInfo[1]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function HoverShow(X, Y) {
|
||
|
|
if (Y <= (Parent.Y + 316 + 196)) {
|
||
|
|
Img.DrawPng(2, X + 3, Y);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function ShowCharacter(X, Y) {
|
||
|
|
//没有正在查看的对象的时候才绘制人物
|
||
|
|
// if (!Parent.LookingInfo) {
|
||
|
|
if (!CharacShow) StructureCharacAni();
|
||
|
|
CharacShow.Draw(X, Y);
|
||
|
|
// }
|
||
|
|
}
|
||
|
|
|
||
|
|
function StructureCharacAni() {
|
||
|
|
local AvaList = [];
|
||
|
|
foreach(Ava in Info.avaS) {
|
||
|
|
if (Ava != 0) AvaList.append(Ava);
|
||
|
|
}
|
||
|
|
CharacShow = Rindro_Draw_Character(Info.job.tointeger(), AvaList, "rest.ani", null);
|
||
|
|
}
|
||
|
|
|
||
|
|
function OnMouseLbDown(X, Y) {
|
||
|
|
if (this.Type == 0) {
|
||
|
|
if (Y <= (Parent.Y + 294 + 218) && Y >= (Parent.Y + 294)) {
|
||
|
|
Parent.LookingInfo = this;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|