767 lines
28 KiB
Plaintext
767 lines
28 KiB
Plaintext
/*
|
|
文件名:BuffSwitching.nut
|
|
路径:Plugins/BuffSwitching/BuffSwitching.nut
|
|
创建日期:2023-02-01 01:09
|
|
文件用途:buff换装
|
|
*/
|
|
|
|
class Window extends BasicsDrawTool {
|
|
//宽度
|
|
Width = null;
|
|
//高度
|
|
Height = null;
|
|
//标题高度
|
|
TitleH = null;
|
|
|
|
//X坐标
|
|
X = null;
|
|
//Y坐标
|
|
Y = null;
|
|
|
|
YMouseSw = true;
|
|
|
|
constructor(gX, gY, gWidth, gHeight, gTitleH) {
|
|
//宽度
|
|
Width = gWidth;
|
|
//高度
|
|
Height = gHeight;
|
|
//标题高度
|
|
TitleH = gTitleH;
|
|
|
|
//X坐标
|
|
X = gX;
|
|
//Y坐标
|
|
Y = gY;
|
|
}
|
|
|
|
//设定鼠标逻辑
|
|
function LockMouse() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 1, 1, X, Y, Width, Height)) {
|
|
IMouse.LockMouseClick();
|
|
YMouseSw = false;
|
|
} else {
|
|
if (YMouseSw == false) {
|
|
IMouse.ReleaseMouseClick();
|
|
YMouseSw = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
function Show(obj) {
|
|
//sq_DrawBox(X, Y, Width, Height, 0xffffffff);
|
|
|
|
//设定鼠标逻辑
|
|
LockMouse();
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//HudPro按钮类
|
|
class BuffSwitchingButtonPro extends BasicsDrawTool // obj -- 按钮名称 -- X坐标 -- Y坐标 -- Ani调用路径 -- 宽度 -- 高度
|
|
{
|
|
obj = null; //Obj对象
|
|
State = 0; //按钮状态
|
|
ClickEnble = false; //点击效果
|
|
ButtonDynamic = false; //动态按钮效果
|
|
BaseFrame = null;
|
|
|
|
CustomClickEnble = false; //自定义点击效果
|
|
CustomClickAnifile = null; //自定义点击效果Ani路径
|
|
CustomButtonName = null; //自定义点击效果名称
|
|
CustomClickFrame = null; //自定义点击效果Ani编号
|
|
CustomClickx = null; //自定义点击效果X坐标
|
|
CustomClicky = null; //自定义点击效果Y坐标
|
|
|
|
|
|
RectEnble = false; //悬停效果
|
|
RectButtonName = null; //悬停名称
|
|
RectBaseAnifile = null; //悬停Ani路径
|
|
RectFrame = null; //非动态按钮的悬停调用Ani编号
|
|
Rectx = null; //悬停X坐标
|
|
Recty = null; //悬停Y坐标
|
|
|
|
|
|
ButtonName = null; //按钮名称
|
|
x = null; //X坐标
|
|
y = null; //Y坐标
|
|
BaseAnifile = null; //调用Ani路径
|
|
width = null; //可点击宽度
|
|
length = null; //可点击高度
|
|
|
|
Mobj = null; //鼠标对象
|
|
//构造函数
|
|
constructor(gObj, gButtonName, gX, gY, gAnifile, gWidth, gLength, gBaseFrame) {
|
|
obj = gObj;
|
|
ButtonName = gButtonName;
|
|
x = gX;
|
|
y = gY;
|
|
BaseAnifile = gAnifile;
|
|
width = gWidth;
|
|
length = gLength;
|
|
BaseFrame = gBaseFrame;
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
}
|
|
//绘制按钮
|
|
function Show() {
|
|
if (ClickEnble) //是否开启点击效果
|
|
{
|
|
if (isLBDown() && State == 0) //按下左键并且按钮处于弹起状态
|
|
{
|
|
State = 1; //按键进入按下状态
|
|
++y;
|
|
}
|
|
if (!isLBDown() && State == 1) //按下左键并且按钮处于弹起状态
|
|
{
|
|
State = 0; //按键进入弹起状态
|
|
--y;
|
|
}
|
|
}
|
|
|
|
if (CustomClickEnble) //是否开启自定义点击效果
|
|
{
|
|
if (isLBDown()) //按下左键并且按钮处于弹起状态
|
|
{
|
|
if (!ButtonDynamic) T_DrawStayAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomClickFrame, CustomButtonName);
|
|
else T_DrawDynamicAni(obj, CustomClickAnifile, CustomClickx, CustomClicky, CustomButtonName);
|
|
}
|
|
}
|
|
|
|
if (RectEnble) //开启悬停效果时
|
|
{
|
|
if ((isInRect() && !isLBDown()) || (isInRect() && !CustomClickEnble)) //如果鼠标悬停的时候 并且没有点击的时候
|
|
{
|
|
//IMouse.SetMouseTask(44);
|
|
if (!ButtonDynamic) T_DrawStayAni(obj, RectBaseAnifile, Rectx, Recty, RectFrame, RectButtonName);
|
|
else T_DrawDynamicAni(obj, RectBaseAnifile, Rectx, Recty, RectButtonName);
|
|
}
|
|
}
|
|
if (!isInRect()) //如果鼠标没有悬停的时候
|
|
{
|
|
//IMouse.SetMouseTask(0);
|
|
if (!ButtonDynamic) T_DrawStayAni(obj, BaseAnifile, x, y, BaseFrame, ButtonName);
|
|
else T_DrawDynamicAni(obj, BaseAnifile, x, y, ButtonName);
|
|
}
|
|
}
|
|
|
|
//设置自定义点击效果
|
|
function SetCustomClickEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
|
|
CustomClickEnble = bool; //自定义点击效果
|
|
CustomClickAnifile = gAnifile; //自定义点击效果Ani路径
|
|
CustomButtonName = gButtonName; //自定义点击效果名称
|
|
CustomClickFrame = gFrame; //自定义点击效果Ani编号
|
|
CustomClickx = gX; //自定义点击效果X坐标
|
|
CustomClicky = gY; //自定义点击效果Y坐标
|
|
}
|
|
|
|
//设置悬停效果
|
|
function SetRectEnble(bool, gButtonName, gX, gY, gAnifile, gFrame) {
|
|
RectEnble = bool; //悬停效果
|
|
RectButtonName = gButtonName; //悬停名称
|
|
RectBaseAnifile = gAnifile; //悬停Ani路径
|
|
RectFrame = gFrame; //非动态按钮的悬停调用Ani编号
|
|
Rectx = gX; //悬停X坐标
|
|
Recty = gY; //悬停Y坐标
|
|
}
|
|
|
|
//设置动态按钮
|
|
function SetClickEnble(bool) {
|
|
ButtonDynamic = bool;
|
|
}
|
|
|
|
//设置点击效果
|
|
function SetClickEnble(bool) {
|
|
ClickEnble = bool;
|
|
}
|
|
|
|
//悬停状态
|
|
function isInRect() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, width, length)) return true;
|
|
else return false;
|
|
}
|
|
//左键按下状态
|
|
function isLBDown() {
|
|
if (isInRect() && Mobj.Lb == 1) return true;
|
|
else return false;
|
|
}
|
|
//左键弹起状态
|
|
function isLBUp() {
|
|
if (isInRect() && Mobj.Lb == 0) return true;
|
|
else return false;
|
|
}
|
|
|
|
//左键单击状态
|
|
function isLBActive() {
|
|
if (isInRect() && Mobj.LbEvent) return true;
|
|
else return false;
|
|
}
|
|
}
|
|
|
|
class BuffSwitchingSkillButtonPro extends BasicsDrawTool // obj -- 按钮名称 -- X坐标 -- Y坐标 -- Ani调用路径 -- 宽度 -- 高度
|
|
{
|
|
obj = null; //Obj对象
|
|
State = 0; //按钮状态
|
|
SkillId = null; //技能ID
|
|
|
|
x = null; //X坐标
|
|
y = null; //Y坐标
|
|
|
|
width = null; //可点击宽度
|
|
length = null; //可点击高度
|
|
|
|
Mobj = null; //鼠标对象
|
|
//构造函数
|
|
constructor(gObj, skillid, gX, gY) {
|
|
obj = gObj;
|
|
SkillId = sq_GetSkill(gObj, skillid);
|
|
x = gX;
|
|
y = gY;
|
|
if (getroottable().rawin("MouseObject")) Mobj = getroottable()["MouseObject"];
|
|
}
|
|
//绘制按钮
|
|
function Show() {
|
|
isLBDown();
|
|
sq_DrawSkillIcon(SkillId, x, y, sq_ALPHA(250));
|
|
}
|
|
|
|
//悬停状态
|
|
function isInRect() {
|
|
if (sq_IsIntersectRect(IMouse.GetXPos(), IMouse.GetYPos(), 5, 5, x, y, 26, 26)) return true;
|
|
else return false;
|
|
}
|
|
|
|
//左键按下状态
|
|
function isLBDown() {
|
|
if (isInRect() && Mobj.Lb == 1) return true;
|
|
else return false;
|
|
}
|
|
//左键弹起状态
|
|
function isLBUp() {
|
|
if (isInRect() && Mobj.Lb == 0) return true;
|
|
else return false;
|
|
}
|
|
|
|
//左键单击状态
|
|
function isLBActive() {
|
|
if (isInRect() && Mobj.LbEvent) return true;
|
|
else return false;
|
|
}
|
|
}
|
|
|
|
class BuffSwitchingSystem extends BasicsDrawTool {
|
|
PageSw = false;
|
|
OpenSw = false;
|
|
|
|
WindowObj = null;
|
|
ExcludeTab = null;
|
|
|
|
SkillData = null;
|
|
EquData = null;
|
|
EquAddress = null;
|
|
AvaData = null;
|
|
AvaAddress = null;
|
|
CreData = null;
|
|
|
|
WindowsObj = null;
|
|
BaseX = -160;
|
|
BaseY = -38;
|
|
State = true;
|
|
|
|
SkillSelectMain = false;
|
|
SelectSkillArr = null;
|
|
|
|
Party = 0;
|
|
|
|
function Addexclude() {
|
|
ExcludeTab = {};
|
|
ExcludeTab.rawset("29201", 1);
|
|
ExcludeTab.rawset("29202", 2);
|
|
ExcludeTab.rawset("29203", 3);
|
|
ExcludeTab.rawset("29204", 4);
|
|
ExcludeTab.rawset("29205", 5);
|
|
ExcludeTab.rawset("39278", 6);
|
|
ExcludeTab.rawset("39400", 7);
|
|
ExcludeTab.rawset("40600", 8);
|
|
ExcludeTab.rawset("41000", 9);
|
|
ExcludeTab.rawset("41800", 10);
|
|
ExcludeTab.rawset("42200", 11);
|
|
ExcludeTab.rawset("43400", 12);
|
|
ExcludeTab.rawset("44600", 13);
|
|
ExcludeTab.rawset("45000", 14);
|
|
ExcludeTab.rawset("45800", 15);
|
|
ExcludeTab.rawset("46200", 16);
|
|
ExcludeTab.rawset("47400", 17);
|
|
ExcludeTab.rawset("48426", 18);
|
|
ExcludeTab.rawset("48600", 19);
|
|
ExcludeTab.rawset("49000", 20);
|
|
ExcludeTab.rawset("49800", 21);
|
|
ExcludeTab.rawset("50200", 22);
|
|
ExcludeTab.rawset("51265", 23);
|
|
ExcludeTab.rawset("51400", 24);
|
|
ExcludeTab.rawset("52600", 25);
|
|
ExcludeTab.rawset("53000", 26);
|
|
ExcludeTab.rawset("53800", 27);
|
|
ExcludeTab.rawset("54200", 28);
|
|
ExcludeTab.rawset("55400", 29);
|
|
ExcludeTab.rawset("55820", 30);
|
|
ExcludeTab.rawset("56600", 31);
|
|
ExcludeTab.rawset("57000", 32);
|
|
ExcludeTab.rawset("57800", 33);
|
|
ExcludeTab.rawset("58200", 34);
|
|
ExcludeTab.rawset("1600000", 35);
|
|
ExcludeTab.rawset("1610000", 36);
|
|
ExcludeTab.rawset("1640000", 37);
|
|
ExcludeTab.rawset("1650000", 38);
|
|
ExcludeTab.rawset("1670000", 39);
|
|
ExcludeTab.rawset("1680000", 40);
|
|
ExcludeTab.rawset("1720000", 41);
|
|
ExcludeTab.rawset("1730000", 42);
|
|
ExcludeTab.rawset("1750000", 43);
|
|
ExcludeTab.rawset("1760000", 44);
|
|
ExcludeTab.rawset("1770000", 45);
|
|
ExcludeTab.rawset("1790000", 46);
|
|
ExcludeTab.rawset("1800000", 47);
|
|
ExcludeTab.rawset("2090000", 48);
|
|
ExcludeTab.rawset("2120000", 49);
|
|
ExcludeTab.rawset("2130000", 50);
|
|
ExcludeTab.rawset("2140000", 51);
|
|
ExcludeTab.rawset("2150000", 52);
|
|
ExcludeTab.rawset("2160000", 53);
|
|
ExcludeTab.rawset("29000", 54);
|
|
ExcludeTab.rawset("31000", 55);
|
|
ExcludeTab.rawset("33679", 56);
|
|
ExcludeTab.rawset("33900", 57);
|
|
ExcludeTab.rawset("35000", 58);
|
|
ExcludeTab.rawset("37000", 59);
|
|
ExcludeTab.rawset("27118", 60);
|
|
ExcludeTab.rawset("27900", 61);
|
|
ExcludeTab.rawset("2190000", 62);
|
|
ExcludeTab.rawset("2190011", 63);
|
|
ExcludeTab.rawset("2190041", 64);
|
|
ExcludeTab.rawset("2190051", 65);
|
|
ExcludeTab.rawset("2190071", 66);
|
|
ExcludeTab.rawset("2190081", 67);
|
|
}
|
|
|
|
constructor() {
|
|
Addexclude();
|
|
EquAddress = [5, 6, 1, 12, 3, 4, 7, 9, 2, 10, 8, 11];
|
|
AvaAddress = [14, 13, 15, 22, 19, 16, 21, 20, 17, 18];
|
|
|
|
//注册换装配置信息回调
|
|
Pack_Control.rawset(20013004, SetMyEquCallBack);
|
|
//开始换装回调
|
|
Pack_Control.rawset(20013008, StartSwitchingCallBack);
|
|
|
|
ReqMyEqu(); //请求服务端数据
|
|
}
|
|
|
|
function SwitchingSendPack(Pos, Id, Type, Space, Index, LocalType) {
|
|
L_sq_SendPackType(19);
|
|
L_sq_SendPackByte(Space);
|
|
L_sq_SendPackWord(Pos);
|
|
L_sq_SendPackDWord(Id);
|
|
L_sq_SendPackDWord(1);
|
|
L_sq_SendPackByte(3);
|
|
L_sq_SendPackWord(Type);
|
|
local OldId;
|
|
if (LocalType == 1) OldId = L_sq_GetCharacterAttribute(0x1C, EquAddress[Index]);
|
|
if (LocalType == 0) OldId = L_sq_GetCharacterAttribute(0x1C, AvaAddress[Index]);
|
|
if (LocalType == 2) OldId = L_sq_GetCharacterAttribute(0x1C, 24);
|
|
if (OldId == null || OldId <= 0 || ExcludeTab.rawin(OldId.tostring())) L_sq_SendPackDWord(0);
|
|
else L_sq_SendPackDWord(OldId);
|
|
L_sq_SendPackDWord(L_sq_Switching());
|
|
L_sq_SendPackByte(0);
|
|
L_sq_SendPackByte(0);
|
|
L_sq_SendPack();
|
|
}
|
|
|
|
//开始换装回调
|
|
function StartSwitchingCallBack(Chunk) {
|
|
local Buffer = Json_STL("StartSwitchingBuffer");
|
|
Buffer.Parse(Chunk, 0, false);
|
|
local RootTab = getroottable();
|
|
if (RootTab.rawin("BuffSwitchingObj")) {
|
|
for (local i = 0; i< Buffer.Get("Acount"); i++) {
|
|
local Pos = Buffer.Get("Apos->" + i);
|
|
if (Pos< 0) continue;
|
|
local Id = Buffer.Get("Aid->" + i);
|
|
local Type = Buffer.Get("AType->" + i);
|
|
RootTab["BuffSwitchingObj"].SwitchingSendPack(Pos, Id, Type, 1, i, 0);
|
|
}
|
|
for (local q = 0; q< Buffer.Get("Ecount"); q++) {
|
|
local Pos = Buffer.Get("Epos->" + q);
|
|
local Id = Buffer.Get("Eid->" + q);
|
|
local Type = Buffer.Get("EType->" + q);
|
|
RootTab["BuffSwitchingObj"].SwitchingSendPack(Pos, Id, Type, 0, q, 1);
|
|
}
|
|
local Crepos = Buffer.Get("Cpos");
|
|
if (Crepos >= 0) {
|
|
local Pos = Buffer.Get("Cpos");
|
|
local Id = Buffer.Get("Creid");
|
|
local Type = Buffer.Get("CreType");
|
|
RootTab["BuffSwitchingObj"].SwitchingSendPack(Pos, Id, Type, 7, 0, 2);
|
|
}
|
|
|
|
}
|
|
|
|
L_sq_SendPackType(130);
|
|
L_sq_SendPackWChar("{\"op\":20013007}");
|
|
L_sq_SendPack();
|
|
}
|
|
|
|
//换装配置信息回调
|
|
function SetMyEquCallBack(Chunk) {
|
|
|
|
local Buffer = Json_STL("GetSetMyEquBuffer");
|
|
Buffer.Parse(Chunk, 0, false);
|
|
local RootTab = getroottable();
|
|
if (RootTab.rawin("BuffSwitchingObj")) {
|
|
local Tobj = RootTab["BuffSwitchingObj"];
|
|
Tobj.EquData = Tobj.StringToArr(Buffer.Get("EquData"));
|
|
Tobj.AvaData = Tobj.StringToArr(Buffer.Get("AvaData"));
|
|
Tobj.CreData = Buffer.Get("CreData");
|
|
}
|
|
|
|
}
|
|
|
|
function ReqMyEqu() {
|
|
L_sq_SendPackType(130);
|
|
L_sq_SendPackWChar("{\"op\":20013003 , \"Party\":" + Party + "}");
|
|
L_sq_SendPack();
|
|
}
|
|
|
|
function GetMyEqu() {
|
|
EquData = [];
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 5));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 6));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 1));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 12));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 3));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 4));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 7));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 9));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 2));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 10));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 8));
|
|
EquData.append(L_sq_GetCharacterAttribute(0x1C, 11));
|
|
|
|
AvaData = [];
|
|
AvaData.append(L_sq_GetCharacterAttribute(0x1C, 14));
|
|
AvaData.append(L_sq_GetCharacterAttribute(0x1C, 13));
|
|
AvaData.append(L_sq_GetCharacterAttribute(0x1C, 15));
|
|
AvaData.append(L_sq_GetCharacterAttribute(0x1C, 22));
|
|
AvaData.append(L_sq_GetCharacterAttribute(0x1C, 19));
|
|
AvaData.append(L_sq_GetCharacterAttribute(0x1C, 16));
|
|
AvaData.append(L_sq_GetCharacterAttribute(0x1C, 21));
|
|
AvaData.append(L_sq_GetCharacterAttribute(0x1C, 20));
|
|
AvaData.append(L_sq_GetCharacterAttribute(0x1C, 17));
|
|
AvaData.append(L_sq_GetCharacterAttribute(0x1C, 18));
|
|
|
|
CreData = L_sq_GetCharacterAttribute(0x1C, 24);
|
|
}
|
|
|
|
//数组转字符串
|
|
function ArrToString(ArrObject) {
|
|
local str = "";
|
|
//str += "[";
|
|
foreach(Value in ArrObject) {
|
|
str += Value.tostring();
|
|
str += ",";
|
|
}
|
|
str = str.slice(0, str.len() - 1);
|
|
//str += "\x005d";
|
|
return str;
|
|
}
|
|
|
|
//字符串转数组
|
|
function StringToArr(Str) {
|
|
Str = Str.slice(1, Str.len());
|
|
local Arr = [];
|
|
local Bpos = 0;
|
|
local Fpos = 0;
|
|
while (true) {
|
|
Fpos = Str.find(",", Bpos);
|
|
if (Fpos == null) break;
|
|
if (Bpos != Fpos) {
|
|
local buf = Str.slice(Bpos, Fpos);
|
|
Arr.append(buf.tointeger());
|
|
}
|
|
Bpos = Fpos + 1;
|
|
}
|
|
Fpos = Str.find("]", Bpos);
|
|
local buf = Str.slice(Bpos, Fpos);
|
|
Arr.append(buf.tointeger());
|
|
return Arr;
|
|
}
|
|
|
|
function DrawMain(obj) {
|
|
|
|
{ //底图层绘制
|
|
//窗口
|
|
T_DrawStayAni(obj, "common/buffswitching/main.ani", BaseX + 222, BaseY + 86, 0, "BuffSwitchingSystemMain");
|
|
//窗口标题
|
|
L_sq_DrawCode("buff换装", BaseX + 376, BaseY + 88, sq_RGBA(230, 200, 155, 250), 0, 0);
|
|
|
|
if (!SkillSelectMain) T_DrawStayAni(obj, "common/buffswitching/main.ani", BaseX + 222 + 160, BaseY + 86 + 48, 2, "BuffSwitchingSystemSkillSlot");
|
|
|
|
L_sq_DrawCode("记录", BaseX + 388, BaseY + 107, sq_RGBA(247, 214, 90, 250), 1, 1);
|
|
|
|
L_sq_DrawCode("装备", BaseX + 282, BaseY + 221, sq_RGBA(247, 214, 90, 250), 1, 1);
|
|
L_sq_DrawCode("装扮", BaseX + 423, BaseY + 221, sq_RGBA(247, 214, 90, 250), 1, 1);
|
|
L_sq_DrawCode("宠物", BaseX + 530, BaseY + 221, sq_RGBA(247, 214, 90, 250), 1, 1);
|
|
|
|
for (local r = 0; r< 3; r++) {
|
|
local PartyButton = BuffSwitchingButtonPro(obj, "BuffSwitchingPartyButton" + r, BaseX + 222 + 10, BaseY + 86 + 42 + (r * 23), "common/buffswitching/party.ani", 24, 14, 0 + (r * 2));
|
|
PartyButton.SetRectEnble(true, "BuffSwitchingPartyButtonr" + r, BaseX + 222 + 10, BaseY + 86 + 42 + (r * 23), "common/buffswitching/party.ani", 1 + (r * 2));
|
|
PartyButton.SetCustomClickEnble(true, "BuffSwitchingPartyButtonc" + r, BaseX + 222 + 10, BaseY + 86 + 43 + (r * 23), "common/buffswitching/party.ani", 1 + (r * 2));
|
|
PartyButton.Show();
|
|
if (PartyButton.isLBActive()) {
|
|
Party = r;
|
|
EquData = null;
|
|
AvaData = null;
|
|
CreData = null;
|
|
ReqMyEqu();
|
|
}
|
|
}
|
|
|
|
T_DrawStayAni(obj, "common/buffswitching/main.ani", BaseX + 222 + 40, BaseY + 86 + 44 + (Party * 23), 7, "BuffSwitchingSystemMainSelect");
|
|
|
|
//如果当前没有技能提升数据
|
|
if (EquData == null && AvaData == null && CreData == null) {
|
|
local AddButton = BuffSwitchingButtonPro(obj, "BuffSwitchingAddButton", BaseX + 222 + 165, BaseY + 86 + 53, "common/buffswitching/main.ani", 26, 26, 4);
|
|
AddButton.SetRectEnble(true, "BuffSwitchingAddButtonr", BaseX + 222 + 165, BaseY + 86 + 53, "common/buffswitching/main.ani", 4);
|
|
AddButton.SetCustomClickEnble(true, "BuffSwitchingAddButtonc", BaseX + 222 + 165, BaseY + 86 + 53, "common/buffswitching/main.ani", 4);
|
|
//if (!SkillSelectMain) AddButton.Show();
|
|
AddButton.Show();
|
|
|
|
if (AddButton.isLBActive() && !SkillSelectMain) {
|
|
// SkillSelectMain = true;
|
|
GetMyEqu();
|
|
|
|
local BuffSwitchingPack = Json_STL("BuffSwitchingPack");
|
|
BuffSwitchingPack.Put("op", 20013001);
|
|
BuffSwitchingPack.Put("Party", Party);
|
|
|
|
foreach(pos, Value in EquData) {
|
|
BuffSwitchingPack.Put("EquData" + pos, Value);
|
|
}
|
|
//BuffSwitchingPack.Put("EquData", ArrToString(EquData));
|
|
foreach(apos, aValue in AvaData) {
|
|
BuffSwitchingPack.Put("AvaData" + apos, aValue);
|
|
}
|
|
//BuffSwitchingPack.Put("AvaData", ArrToString(AvaData));
|
|
BuffSwitchingPack.Put("CreData", CreData);
|
|
|
|
local str = BuffSwitchingPack.GetString();
|
|
//print(str);
|
|
L_sq_SendPackType(130);
|
|
L_sq_SendPackWChar(str);
|
|
L_sq_SendPack();
|
|
BuffSwitchingPack.Delete();
|
|
}
|
|
|
|
} else {
|
|
local Skill = sq_GetSkill(obj, 174);
|
|
sq_DrawSkillIcon(Skill, BaseX + 222 + 164, BaseY + 86 + 51, sq_ALPHA(250));
|
|
// local SkillLevel = sq_GetSkillLevel(obj, SkillData);
|
|
// L_sq_DrawCode("Lv." + SkillLevel, BaseX + 222 + 165, BaseY + 86 + 51 + 30, sq_RGBA(230, 200, 155, 250), 1, 1);
|
|
L_sq_DrawCode("生效", BaseX + 222 + 167, BaseY + 86 + 51 + 30, sq_RGBA(230, 200, 155, 250), 1, 1);
|
|
|
|
{ //装备
|
|
|
|
for (local i = 0; i< 12; i++) {
|
|
local z = i;
|
|
if (i == 9 || i == 10) z = i + 1;
|
|
if (i == 11) z = i + 4;
|
|
if (EquData[i] != 0) L_Sq_DrawItem(BaseX + 231 + ((z % 4) * 32), BaseY + 240 + ((z / 4) * 32), EquData[i], 1, 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
{ //时装
|
|
for (local q = 0; q< 10; q++) {
|
|
local z = q + 1;
|
|
if (q >= 7) z = q + 2;
|
|
if (AvaData[q] != 0) L_Sq_DrawItem(BaseX + 370 + ((z % 4) * 33), BaseY + 240 + ((z / 4) * 33), AvaData[q], 1, 0, 0, 0);
|
|
}
|
|
}
|
|
|
|
{ //宠物
|
|
if (CreData != 0) L_Sq_DrawItem(BaseX + 527, BaseY + 250, CreData, 1, 0, 0, 0);
|
|
}
|
|
|
|
local DeleteButton = BuffSwitchingButtonPro(obj, "BuffSwitchingDeleteButton", BaseX + 222 + 200, BaseY + 86 + 50, "common/buffswitching/main.ani", 26, 26, 8);
|
|
DeleteButton.SetRectEnble(true, "BuffSwitchingDeleteButtonr", BaseX + 222 + 200, BaseY + 86 + 50, "common/buffswitching/main.ani", 9);
|
|
DeleteButton.SetCustomClickEnble(true, "BuffSwitchingDeleteButtonc", BaseX + 222 + 200, BaseY + 86 + 50, "common/buffswitching/main.ani", 10);
|
|
DeleteButton.Show();
|
|
|
|
if (DeleteButton.isLBActive()) {
|
|
EquData = null;
|
|
AvaData = null;
|
|
CreData = null;
|
|
}
|
|
}
|
|
|
|
/*
|
|
//选择技能
|
|
if (SkillSelectMain) {
|
|
//候选技能表
|
|
if (SelectSkillArr == null) {
|
|
SelectSkillArr = [];
|
|
local skillmgr = obj.getSkillManager();
|
|
for (local i = 0; i < 255; i++) {
|
|
local skl = sq_GetSkill(obj, i);
|
|
if (skl) {
|
|
local id = skillmgr.getSlotindex(i);
|
|
if ((id >= 0 && id <= 6) || (id >= 198 && id <= 203)) {
|
|
SelectSkillArr.append(i);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//返回按钮
|
|
local LeftButton = BuffSwitchingButtonPro(obj, "BuffSwitchingLButton", BaseX + 222 + 165 + 170, BaseY + 86 + 53 + 58, "common/buffswitching/main.ani", 13, 9, 5);
|
|
LeftButton.SetRectEnble(true, "BuffSwitchingLButtonr", BaseX + 222 + 165 + 170, BaseY + 86 + 53 + 58, "common/buffswitching/main.ani", 6);
|
|
LeftButton.SetCustomClickEnble(true, "BuffSwitchingLButtonc", BaseX + 222 + 165 + 170, BaseY + 86 + 53 + 58, "common/buffswitching/main.ani", 7);
|
|
LeftButton.Show();
|
|
|
|
if (LeftButton.isLBActive()) {
|
|
SkillSelectMain = false;
|
|
SelectSkillArr = null;
|
|
}
|
|
|
|
//for (local i; i < SelectSkillArr.len(); i++) {
|
|
for (local i = 0; i < SelectSkillArr.len(); i++) {
|
|
local Id = SelectSkillArr[i];
|
|
local SkillButton = BuffSwitchingSkillButtonPro(obj, Id, BaseX + 222 + 24 + ((i % 6) * 56), BaseY + 86 + 42 + ((i / 6) * 32));
|
|
SkillButton.Show();
|
|
if (SkillButton.isLBActive()) {
|
|
SkillData = Id;
|
|
GetMyEqu();
|
|
SkillSelectMain = false;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
*/
|
|
}
|
|
}
|
|
|
|
function Proc(obj) {
|
|
//print(sq_GetPopupWindowMainCotrol(267));
|
|
//如果背包打开 绘制系统开启
|
|
|
|
if (State && OpenSw) {
|
|
if (WindowObj) {
|
|
DrawMain(obj);
|
|
WindowObj.Show(obj);
|
|
} else {
|
|
WindowObj = Window(BaseX, BaseY, 356, 288, 10);
|
|
}
|
|
} else {
|
|
if (WindowObj && WindowObj.YMouseSw == false) {
|
|
IMouse.ReleaseMouseClick();
|
|
WindowObj.YMouseSw = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
function SyncData(x, y) {
|
|
BaseX = x;
|
|
BaseY = y;
|
|
State = true;
|
|
if (WindowObj) {
|
|
WindowObj.X = x + 222;
|
|
WindowObj.Y = y + 86;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//入口
|
|
function BuffSwitching(obj) {
|
|
local RootTab = getroottable();
|
|
if (!RootTab.rawin("BuffSwitchingObj")) {
|
|
local Cobj = BuffSwitchingSystem();
|
|
RootTab.rawset("BuffSwitchingObj", Cobj);
|
|
} else {
|
|
RootTab["BuffSwitchingObj"].Proc(obj);
|
|
//RootTab["BuffSwitchingObj"].State = false;
|
|
}
|
|
|
|
local Winddddd = sq_GetPopupWindowMainCotrol(244);
|
|
if (!Winddddd) {
|
|
RootTab["BuffSwitchingObj"].OpenSw = false;
|
|
RootTab["BuffSwitchingObj"].State = false;
|
|
RootTab["BuffSwitchingObj"].PageSw = false;
|
|
}
|
|
|
|
/*
|
|
local Winddddd = sq_GetPopupWindowMainCotrol(244);
|
|
if(Winddddd)
|
|
{
|
|
local BaseX = Winddddd.GetXPos();
|
|
local BaseY = Winddddd.GetYPos();
|
|
|
|
|
|
local OpenButton = BuffSwitchingButtonPro(obj, "BuffSwitchingOpenButton", BaseX , BaseY, "common/buffswitching/main.ani", 26, 26, 11);
|
|
OpenButton.SetRectEnble(true, "BuffSwitchingOpenButtonr", BaseX, BaseY , "common/buffswitching/main.ani", 12);
|
|
OpenButton.SetCustomClickEnble(true, "BuffSwitchingOpenButtonc", BaseX , BaseY, "common/buffswitching/main.ani", 13);
|
|
OpenButton.Show();
|
|
|
|
if (OpenButton.isLBActive()) {
|
|
//RootTab["BuffSwitchingObj"].OpenSw = !RootTab["BuffSwitchingObj"].OpenSw;
|
|
print(1111);
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
|
|
//call
|
|
function Sq_BuffSwitchingCallBack(x, y) {
|
|
local RootTab = getroottable();
|
|
if (RootTab.rawin("BuffSwitchingObj") && RootTab["BuffSwitchingObj"].PageSw == true) {
|
|
RootTab["BuffSwitchingObj"].SyncData(x - 1430, y - 500);
|
|
//RootTab["BuffSwitchingObj"].PageSw = false;
|
|
}
|
|
}
|
|
|
|
function Sq_SwitchingCallBack(x, y) {
|
|
/*
|
|
local RootTab = getroottable();
|
|
if (RootTab.rawin("BuffSwitchingObj")) {
|
|
RootTab["BuffSwitchingObj"].PageSw = true;
|
|
}
|
|
*/
|
|
|
|
|
|
local RootTab = getroottable();
|
|
|
|
if (RootTab.rawin("BuffSwitchingObj") && RootTab["BuffSwitchingObj"].PageSw == true) {
|
|
RootTab["BuffSwitchingObj"].SyncData(-200, 0);
|
|
//RootTab["BuffSwitchingObj"].PageSw = false;
|
|
}
|
|
|
|
|
|
local BaseX = x - 600 + 141;
|
|
local BaseY = y - 200 - 83;
|
|
|
|
local obj = sq_GetMyMasterCharacter();
|
|
if (!obj) return;
|
|
local OpenButton = BuffSwitchingButtonPro(obj, "BuffSwitchingOpenButton", BaseX, BaseY, "common/buffswitching/main.ani", 55, 55, 14);
|
|
OpenButton.SetRectEnble(true, "BuffSwitchingOpenButtonr", BaseX, BaseY, "common/buffswitching/main.ani", 15);
|
|
OpenButton.SetCustomClickEnble(true, "BuffSwitchingOpenButtonc", BaseX, BaseY, "common/buffswitching/main.ani", 16);
|
|
OpenButton.Show();
|
|
|
|
if (OpenButton.isLBActive()) {
|
|
RootTab["BuffSwitchingObj"].OpenSw = !RootTab["BuffSwitchingObj"].OpenSw;
|
|
RootTab["BuffSwitchingObj"].State = !RootTab["BuffSwitchingObj"].State;
|
|
RootTab["BuffSwitchingObj"].PageSw = true;
|
|
//print(1111);
|
|
}
|
|
} |