This commit is contained in:
Lenheart 2025-07-22 23:55:25 +08:00
parent 5b73ee00af
commit aef5154b35
4 changed files with 359 additions and 7 deletions

View File

@ -176,6 +176,7 @@ class Rindro_BaseToolClass {
} }
//初始化根表成员 //初始化根表成员
function InitClass(Name) { function InitClass(Name) {
local RootTab = getroottable(); local RootTab = getroottable();

View File

@ -20,9 +20,14 @@ class AncientheroLuckyBoxC extends LenheartNewUI_Windows {
BoxId = 15; BoxId = 15;
//盒子数量 //盒子数量
BoxCount = 0; BoxCount = 0;
//能量
Energy = 0;
//奖励查询网站
RewardUrl = "https://www.baidu.com";
//打开状态 0未打开 1单抽 10十连抽 //打开状态 0未打开 1单抽 10十连抽
OpenFlag = 0; OpenFlag = 1;
//抽奖模式按钮集合 //抽奖模式按钮集合
OpenBtns = null; OpenBtns = null;
@ -30,6 +35,10 @@ class AncientheroLuckyBoxC extends LenheartNewUI_Windows {
//动画队列 //动画队列
AniQueue = null; AniQueue = null;
//奖励动画盒子
SmallBoxList = null;
BigBox = null;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
Childrens = []; Childrens = [];
AniQueue = QuestQueue();; AniQueue = QuestQueue();;
@ -41,16 +50,114 @@ class AncientheroLuckyBoxC extends LenheartNewUI_Windows {
Img = {}; Img = {};
Img["main"] <- Rindro_Image("interface2/event/chn_event_2020/201029_ancientheroluckybox/ancientbox.img"); Img["main"] <- Rindro_Image("interface2/event/chn_event_2020/201029_ancientheroluckybox/ancientbox.img");
Img["yosin"] <- Rindro_Image("yosin/db_newani.img"); Img["yosin"] <- Rindro_Image("yosin/db_newani.img");
Img["yosin_bd"] <- Rindro_Image("yosin/db_newani_bd.img");
SmallBoxList = [];
for (local i = 0; i< 20; i++) {
local Buffer = AncientheroLuckyBoxC_Box(this, i);
SmallBoxList.append(Buffer);
}
BigBox = AncientheroLuckyBoxC_BigBox(this, 99);
//配置回包
RegisterPack(20074004, function(Chunk) {
local Jso = Json.Decode(Chunk);
this.Visible = true;
//重置
OpenFlag = 0;
foreach(Obj in SmallBoxList) {
Obj.Reset();
BigBox.Reset();
}
this.BoxId = Jso["BoxId"];
this.BoxCount = Jso["BoxCount"];
this.RewardUrl = Jso["ProbabilityTab"];
this.Energy = Jso["nl"];
}.bindenv(this));
//配置回包 //配置回包
RegisterPack(20094002, function(Chunk) { RegisterPack(20094008, function(Chunk) {
local Jso = Json.Decode(Chunk); local Jso = Json.Decode(Chunk);
// BoxId = Jso["boxId"]; this.BoxCount = Jso["BoxCount"];
this.Energy = Jso["nl"];
this.OpenFlag = Jso["itemBuffers"].len();
if (this.OpenFlag == 10) {
foreach(Pos, obj in Jso["itemBuffers"]) {
//因为曾服务端这里发的数组 估计是土罐抄过来的龙盒只有一个道具 只取0号位
local Info = obj;
local RandomScript = GetRewardAniScript(Info.typ);
SmallBoxList[Pos].SetInfo(Info.itemid, Info.num, RandomScript, Info.typ);
}
} else if (this.OpenFlag == 1) {
local Info = Jso["itemBuffers"][0];
BigBox.SetInfo(Info.itemid, Info.num, GetRewardAniScript(Info.typ), Info.typ);
}
}.bindenv(this)); }.bindenv(this));
// local monipack = "{\"uid\":1,\"op\":20094008,\"itemBuffers\":[[{\"typ\":1,\"itemid\":3037,\"num\":3}],[{\"typ\":1,\"itemid\":3037,\"num\":2}],[{\"typ\":1,\"itemid\":3037,\"num\":1}],[{\"typ\":1,\"itemid\":3037,\"num\":1}],[{\"typ\":1,\"itemid\":3037,\"num\":1}],[{\"typ\":1,\"itemid\":3037,\"num\":3}],[{\"typ\":1,\"itemid\":3037,\"num\":3}],[{\"typ\":1,\"itemid\":3037,\"num\":3}],[{\"typ\":1,\"itemid\":3037,\"num\":3}],[{\"typ\":2,\"itemid\":3037,\"num\":1}]],\"nl\":80,\"cid\":1,\"BoxCount\":67}";
// local monipack = "{\"BoxCount\":76,\"cid\":1,\"itemBuffers\":[{\"itemid\":3038,\"num\":1,\"typ\":3}],\"nl\":0,\"op\":20094008,\"uid\":1}";
// Pack_Control[20094008](monipack);
}
function GetRewardAniScript(Grade) {
local Middle = "";
switch (Grade) {
case 0: {
Middle = "box_b";
break;
}
case 1: {
switch (sq_getRandom(0, 1)) {
case 0:
Middle = "box_b_a";
break;
case 1:
Middle = "box_a";
break;
}
break;
}
case 2: {
switch (sq_getRandom(0, 2)) {
case 0:
Middle = "box_b_s";
break;
case 1:
Middle = "box_a_s";
break;
case 2:
Middle = "box_s";
break;
}
break;
}
case 3: {
switch (sq_getRandom(0, 3)) {
case 0:
Middle = "box_b_ss";
break;
case 1:
Middle = "box_a_ss";
break;
case 2:
Middle = "box_s_ss";
break;
case 3:
Middle = "box_ss";
break;
}
break;
}
}
return Middle;
} }
function RegisterWidget() { function RegisterWidget() {
@ -92,7 +199,22 @@ class AncientheroLuckyBoxC extends LenheartNewUI_Windows {
AddChild(TenOpenBtn); AddChild(TenOpenBtn);
OpenBtns.append(TenOpenBtn); OpenBtns.append(TenOpenBtn);
//抽奖按钮
local UseButton = LenheartNewUI_ButtonText(356, 500, 15, "开 启");
// UseButton.SetFrame(null, 323);
UseButton.SetTextOffset(-3, 1);
UseButton.OnClickEx = function(Btn) {
if (OpenFlag == 0 || AniQueue.Queue.len() != 0) return;
foreach(Obj in SmallBoxList) {
Obj.Reset();
BigBox.Reset();
}
SendPackEx({
op = 20094005,
Num = OpenFlag
});
}.bindenv(this);
AddChild(UseButton);
} }
@ -126,9 +248,31 @@ class AncientheroLuckyBoxC extends LenheartNewUI_Windows {
if (OpenFlag == 0) Img["main"].DrawPng(1, X + 5, Y + 25); if (OpenFlag == 0) Img["main"].DrawPng(1, X + 5, Y + 25);
//绘制圣者遗物箱图标 //绘制圣者遗物箱图标
DrawItemBase(X + 377, Y + 394, BoxId, 1); DrawItemBase(X + 377, Y + 394, BoxId, BoxCount);
//绘制圣者遗物箱数量 //绘制圣者遗物箱能量
if (Energy< 100) Img["yosin_bd"].DrawPng(Energy, X + 350, Y + 368);
else {
Img["yosin"].DrawPng(2, X, Y);
local T = Clock() % 2000;
local Alpha = 0;
if (T< 1000) {
Alpha = 150 + 105 * (T.tofloat() / 1000.0);
} else {
Alpha = 255 - 105 * ((T - 1000).tofloat() / 1000.0);
}
Img["yosin_bd"].DrawExPng(100, X + 350, Y + 368, 0, sq_RGBA(255, 255, 255, Alpha.tointeger()), 1.0, 1.0)
}
L_sq_DrawCode(Energy.tostring() + "%", X + 426 - (LenheartTextClass.GetStringLength(Energy.tostring() + "%") / 2), Y + 437, sq_RGBA(179, 169, 135, 255), 0, 1);
if (OpenFlag == 10) {
//绘制奖励动画
for (local i = 0; i< SmallBoxList.len(); i++) {
SmallBoxList[i].Draw(obj, X - 12 + (150 * (i % 5)), Y + 70 + (128 * (i / 5)));
}
} else if (OpenFlag == 1) {
BigBox.Draw(obj, X + 226, Y + 80);
}
} }
@ -237,4 +381,209 @@ class QuestQueue {
if(Time >= 2000)Obj.RemoveQuest(Name); if(Time >= 2000)Obj.RemoveQuest(Name);
}.bindenv(this)); }.bindenv(this));
*/ */
}
class AncientheroLuckyBoxC_Box extends Rindro_BaseToolClass {
//父对象
Parent = null;
//标识ID
Idx = null;
//状态 0未设置 1已设置 2播放动画 3播放动画结束
Status = 0;
//道具是否显示
ItemVisFlag = false;
//奖励道具
ItemId = null;
//奖励道具名字
ItemName = null;
//奖励道具名字颜色
ItemNameColor = null;
//奖励道具数量
Count = null;
//奖励动画
Ani = null;
//音效
Sound = null;
//品级
Grade = null;
GradeList = ["b", "a", "s", "ss"];
GradeCorlorList = [sq_RGBA(255, 255, 255, 255), sq_RGBA(104, 213, 237, 255), sq_RGBA(179, 107, 255, 255), sq_RGBA(255, 0, 240, 255), sq_RGBA(255, 177, 0, 255), sq_RGBA(255, 102, 102, 255)];
//标识Flag
Flag = null;
constructor(P, Idx) {
this.Parent = P;
this.Idx = Idx;
}
function Draw(obj, X, Y) {
//如果已设置 可以开始播放
if (Status == 1) {
Status = 2;
Flag = this.Idx + Ani + Clock();
}
if (Status == 2) {
local Ani = DrawAniEx(X, Y, Ani, Flag);
//当Ani播放时间大于百分之90时
if (sq_GetCurrentTime(Ani) > (Ani.getDelaySum(false) * 0.9).tointeger()) {
ItemVisFlag = true;
}
if (sq_IsEnd(Ani)) {
sq_Rewind(Ani);
Status = 3;
}
}
//如果需要显示道具
if (ItemVisFlag) {
X += 10;
DrawAniEx(X + 24, Y + 80, "common/ancientheroluckybox/animation/item_mini_" + this.Grade + "_loop.ani", Flag + "Item");
//绘制道具
Parent.DrawItemBase(X + 27, Y + 83, ItemId, Count);
//绘制道具名字
L_sq_DrawCode(this.ItemName, X + 107 - (LenheartTextClass.GetStringLength(this.ItemName) / 2), Y + 91, ItemNameColor, 0, 1);
DrawAniEx(X + 24 + 25, Y + 80 + 5, "common/ancientheroluckybox/animation/item_mini_" + this.Grade + "_start.ani", Flag + "ItemStart");
}
}
//设置信息
function SetInfo(ItemId, Count, RandomScript, Grade) {
if (Status == 0) {
this.ItemId = ItemId;
local ItemObject = L_sq_GetItem(ItemId);
local NamePointer = L_sq_RA(ItemObject + 0x20);
this.ItemName = NativePointer(L_sq_I2P(NamePointer)).readUnicodeString();
local Rarity = L_sq_RA(ItemObject + 0xF4);
this.ItemNameColor = GradeCorlorList[Rarity];
this.Count = Count;
this.Ani = "common/ancientheroluckybox/animation/mini_" + RandomScript + ".ani";
this.Sound = "ANCIENTBOX_OPEN_" + RandomScript.slice(4);
this.Grade = GradeList[Grade];
R_Utils.PlaySound(this.Sound);
Status = 1;
}
}
//重置
function Reset() {
Status = 0;
ItemId = null;
ItemName = null;
ItemNameColor = null;
Ani = null;
Sound = null;
ItemVisFlag = false;
}
}
class AncientheroLuckyBoxC_BigBox extends Rindro_BaseToolClass {
//父对象
Parent = null;
//标识ID
Idx = null;
//状态 0未设置 1已设置 2播放动画 3播放动画结束
Status = 0;
//道具是否显示
ItemVisFlag = false;
//奖励道具
ItemId = null;
//奖励道具名字
ItemName = null;
//奖励道具名字颜色
ItemNameColor = null;
//奖励道具数量
Count = null;
//奖励动画
Ani = null;
//音效
Sound = null;
//品级
Grade = null;
GradeList = ["b", "a", "s", "ss"];
GradeCorlorList = [sq_RGBA(255, 255, 255, 255), sq_RGBA(104, 213, 237, 255), sq_RGBA(179, 107, 255, 255), sq_RGBA(255, 0, 240, 255), sq_RGBA(255, 177, 0, 255), sq_RGBA(255, 102, 102, 255)];
//标识Flag
Flag = null;
constructor(P, Idx) {
this.Parent = P;
this.Idx = Idx;
}
function Draw(obj, X, Y) {
//如果已设置 可以开始播放
if (Status == 1) {
Status = 2;
Flag = this.Idx + Ani + Clock();
}
if (Status == 2) {
local Ani = DrawAniEx(X, Y, Ani, Flag);
//当Ani播放时间大于百分之90时
if (sq_GetCurrentTime(Ani) > (Ani.getDelaySum(false) * 0.9).tointeger()) {
ItemVisFlag = true;
}
if (sq_IsEnd(Ani)) {
sq_Rewind(Ani);
Status = 3;
}
}
//如果需要显示道具
if (ItemVisFlag) {
X += 74;
Y += 60;
DrawAniEx(X + 24, Y + 80, "common/ancientheroluckybox/animation/item_mini_" + this.Grade + "_loop.ani", Flag + "Item");
//绘制道具
Parent.DrawItemBase(X + 27, Y + 83, ItemId, Count);
//绘制道具名字
L_sq_DrawCode(this.ItemName, X + 107 - (LenheartTextClass.GetStringLength(this.ItemName) / 2), Y + 91, ItemNameColor, 0, 1);
DrawAniEx(X + 24 + 25, Y + 80 + 5, "common/ancientheroluckybox/animation/item_mini_" + this.Grade + "_start.ani", Flag + "ItemStart");
}
}
//设置信息
function SetInfo(ItemId, Count, RandomScript, Grade) {
if (Status == 0) {
this.ItemId = ItemId;
local ItemObject = L_sq_GetItem(ItemId);
local NamePointer = L_sq_RA(ItemObject + 0x20);
this.ItemName = NativePointer(L_sq_I2P(NamePointer)).readUnicodeString();
local Rarity = L_sq_RA(ItemObject + 0xF4);
this.ItemNameColor = GradeCorlorList[Rarity];
this.Count = Count;
this.Ani = "common/ancientheroluckybox/animation/" + RandomScript + ".ani";
this.Sound = "ANCIENTBOX_OPEN_" + RandomScript.slice(4);
this.Grade = GradeList[Grade];
R_Utils.PlaySound(this.Sound);
Status = 1;
}
}
//重置
function Reset() {
Status = 0;
ItemId = null;
ItemName = null;
ItemNameColor = null;
Ani = null;
Sound = null;
ItemVisFlag = false;
}
} }

View File

@ -327,7 +327,6 @@ class WorldBossC extends LenheartNewUI_Windows {
function Show(obj) { function Show(obj) {
DrawMain(obj); DrawMain(obj);
LenheartNewUI_Windows.Show(obj); LenheartNewUI_Windows.Show(obj);
} }
//进入副本初始化包Flag //进入副本初始化包Flag

View File

@ -151,5 +151,8 @@
}, },
"Project/TH_CombatRank": { "Project/TH_CombatRank": {
"description": "桃花定制-战力榜" "description": "桃花定制-战力榜"
},
"Project/AncientheroLuckyBox": {
"description": "圣者遗物箱"
} }
} }