1691 lines
71 KiB
Plaintext
1691 lines
71 KiB
Plaintext
return;
|
||
//贪玩宝珠拆解
|
||
Cb_Use_Item_Sp_Func[TW_DisassembleCouponId] <- function(SUser, ItemId) {
|
||
SUser.GiveItem(ItemId, 1);
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
local ItemObj = InvenObj.GetSlot(1, 9);
|
||
if (ItemObj.GetIndex() != 0) {
|
||
local OldEn = ItemObj.GetEnchanting();
|
||
if (OldEn) {
|
||
if (OldEn in TW_DisassembleTable) {
|
||
ItemObj.SetEnchanting(0);
|
||
ItemObj.Flush();
|
||
SUser.SendUpdateItemList(1, 0, 9);
|
||
local ItemName = PvfItem.GetNameById(TW_DisassembleTable[OldEn]);
|
||
local Ret = SUser.GiveItem(TW_DisassembleTable[OldEn], 1);
|
||
if (!Ret) {
|
||
local T = {};
|
||
T[TW_DisassembleTable[OldEn]] <- 1;
|
||
SUser.SendMail(T, {
|
||
Title = TW_STR_00001,
|
||
Text = TW_STR_00002
|
||
})
|
||
SUser.SendNotiPacketMessage(TW_STR_00003, 8);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00004, ItemName), 8);
|
||
}
|
||
}
|
||
}
|
||
} else {
|
||
SUser.SendNotiPacketMessage(TW_STR_00018, 8);
|
||
}
|
||
} else {
|
||
SUser.SendNotiPacketMessage(TW_STR_00018, 8);
|
||
}
|
||
}
|
||
//贪玩转职书
|
||
Cb_Use_Item_Sp_Func[TW_GrowTypeBook0] <- function(SUser, ItemId) {
|
||
SUser.ChangeGrowType(0, 0);
|
||
SUser.SendNotiPacket(0, 2, 0);
|
||
SUser.InitSkillW(0, 0);
|
||
}
|
||
Cb_Use_Item_Sp_Func[TW_GrowTypeBook1] <- function(SUser, ItemId) {
|
||
SUser.ChangeGrowType(1, 1);
|
||
SUser.SendNotiPacket(0, 2, 0);
|
||
SUser.InitSkillW(1, 1);
|
||
}
|
||
Cb_Use_Item_Sp_Func[TW_GrowTypeBook2] <- function(SUser, ItemId) {
|
||
SUser.ChangeGrowType(2, 1);
|
||
SUser.SendNotiPacket(0, 2, 0);
|
||
SUser.InitSkillW(2, 1);
|
||
}
|
||
Cb_Use_Item_Sp_Func[TW_GrowTypeBook3] <- function(SUser, ItemId) {
|
||
SUser.ChangeGrowType(3, 1);
|
||
SUser.SendNotiPacket(0, 2, 0);
|
||
SUser.InitSkillW(3, 1);
|
||
}
|
||
Cb_Use_Item_Sp_Func[TW_GrowTypeBook4] <- function(SUser, ItemId) {
|
||
SUser.ChangeGrowType(4, 1);
|
||
SUser.SendNotiPacket(0, 2, 0);
|
||
SUser.InitSkillW(4, 1);
|
||
}
|
||
|
||
//贪玩 任务完成卷
|
||
foreach(_ItemId, QuestId in TW_QuestClearCouponTable) {
|
||
Cb_Use_Item_Sp_Func[_ItemId] <- function(SUser, ItemId) {
|
||
SUser.ClearQuest_Gm(TW_QuestClearCouponTable[ItemId]);
|
||
}
|
||
}
|
||
|
||
//贪玩 锻造卷固定
|
||
foreach(_ItemId, ForgingInfo in TW_ForgingBaseCouponTable) {
|
||
Cb_Use_Item_Sp_Func[_ItemId] <- function(SUser, ItemId) {
|
||
local Info = TW_ForgingBaseCouponTable[ItemId];
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
local ItemObj = InvenObj.GetSlot(1, 9);
|
||
//空装备
|
||
if (ItemObj.IsEmpty) {
|
||
SUser.SendNotiPacketMessage(TW_STR_00005, 8);
|
||
SUser.GiveItem(ItemId, 1);
|
||
return;
|
||
}
|
||
local OldLevel = ItemObj.GetForging();
|
||
local RandNum = MathClass.Rand(0, 100);
|
||
if (RandNum <= Info.Probability) {
|
||
ItemObj.SetForging(Info.Level);
|
||
ItemObj.Flush();
|
||
SUser.SendUpdateItemList(1, 0, 9);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00006, Info.Level), 8);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00007, OldLevel), 8);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
//贪玩 锻造卷提升
|
||
foreach(_ItemId, ForgingInfo in TW_ForgingUpCouponTable) {
|
||
Cb_Use_Item_Sp_Func[_ItemId] <- function(SUser, ItemId) {
|
||
local DLevel = TW_ForgingUpCouponTable[ItemId];
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
local ItemObj = InvenObj.GetSlot(1, 9);
|
||
//空装备
|
||
if (ItemObj.IsEmpty) {
|
||
SUser.SendNotiPacketMessage(TW_STR_00005, 8);
|
||
SUser.GiveItem(ItemId, 1);
|
||
return;
|
||
}
|
||
local OldLevel = ItemObj.GetForging();
|
||
if (OldLevel >= TW_MaxForgingLevel) {
|
||
SUser.SendNotiPacketMessage(TW_STR_00008, 8);
|
||
SUser.GiveItem(ItemId, 1);
|
||
return;
|
||
}
|
||
local RandNum = MathClass.Rand(0, 100);
|
||
if (RandNum <= DLevel) {
|
||
ItemObj.SetForging(OldLevel + 1);
|
||
ItemObj.Flush();
|
||
SUser.SendUpdateItemList(1, 0, 9);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00006, (OldLevel + 1)), 8);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00007, OldLevel), 8);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
//贪玩 宠物升级卷
|
||
foreach(_ItemId, baseInfo in TW_Creature_UpTable) {
|
||
local Info = clone(baseInfo);
|
||
Cb_Use_Item_Sp_Func[_ItemId] <- function(SUser, ItemId) {
|
||
local Cid = SUser.GetCID();
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
//是否拥有足够的材料
|
||
if (InvenObj.CheckArrItemCount(Info.Stk)) {
|
||
local ItemObj = InvenObj.GetSlot(3, 0);
|
||
if (ItemObj.GetIndex() == Info.S_Id) {
|
||
InvenObj.DeleteArrItemCount(Info.Stk);
|
||
SUser.SendItemSpace(7);
|
||
local RandNum = MathClass.Rand(0, 100);
|
||
if (RandNum <= Info.Probability) {
|
||
ItemObj.Delete();
|
||
local Sql = "delete from taiwan_cain_2nd.creature_items where charac_no=" + Cid + " and slot = 0;'";
|
||
Sq_MysqlExecNoRet(Sql);
|
||
SUser.SendItemSpace(7);
|
||
SUser.GiveItem(Info.D_Id, 1);
|
||
local ItemName = PvfItem.GetNameById(Info.D_Id);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00009, ItemName), 8);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(TW_STR_00010, 8);
|
||
}
|
||
} else {
|
||
SUser.GiveItem(ItemId, 1);
|
||
SUser.SendNotiPacketMessage(TW_STR_00011, 8);
|
||
}
|
||
} else {
|
||
SUser.GiveItem(ItemId, 1);
|
||
SUser.SendNotiPacketMessage(TW_STR_00012, 8);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
//贪玩 宠物回收
|
||
Cb_Use_Item_Sp_Func[TW_Creature_RecTableStk] <- function(SUser, ItemId) {
|
||
SUser.GiveItem(ItemId, 1);
|
||
local Cid = SUser.GetCID();
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
local ItemObj = InvenObj.GetSlot(3, 0);
|
||
local Flag = false;
|
||
foreach(Infoobj in TW_Creature_RecTable) {
|
||
local Info = clone(Infoobj);
|
||
if (ItemObj.GetIndex() == Info.S_Id) {
|
||
Flag = true;
|
||
ItemObj.Delete();
|
||
local Sql = "delete from taiwan_cain_2nd.creature_items where charac_no=" + Cid + " and slot = 0;'";
|
||
Sq_MysqlExecNoRet(Sql);
|
||
SUser.SendItemSpace(7);
|
||
|
||
local ItemName = PvfItem.GetNameById(Info.S_Id);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00038, ItemName), 8);
|
||
|
||
foreach(io in Info.Stk) {
|
||
SUser.GiveItem(io.Id, io.Count);
|
||
}
|
||
}
|
||
}
|
||
if (!Flag) SUser.SendNotiPacketMessage(TW_STR_00037, 8);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
//贪玩 时装升级卷
|
||
foreach(_ItemId, baseInfo in TW_Avatar_UpTable) {
|
||
local Info = clone(baseInfo);
|
||
Cb_Use_Item_Sp_Func[_ItemId] <- function(SUser, ItemId) {
|
||
local Cid = SUser.GetCID();
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
//是否拥有足够的材料
|
||
if (InvenObj.CheckArrItemCount(Info.Stk)) {
|
||
local ItemObj = InvenObj.GetSlot(2, 0);
|
||
if (ItemObj.GetIndex() == Info.S_Id) {
|
||
InvenObj.DeleteArrItemCount(Info.Stk);
|
||
local RandNum = MathClass.Rand(0, 100);
|
||
if (RandNum <= Info.Probability) {
|
||
ItemObj.Delete();
|
||
local Sql = "delete from taiwan_cain_2nd.user_items where charac_no=" + Cid + " and slot = 10;'";
|
||
Sq_MysqlExecNoRet(Sql);
|
||
SUser.SendItemSpace(1);
|
||
SUser.GiveItem(Info.D_Id, 1);
|
||
local ItemName = PvfItem.GetNameById(Info.D_Id);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00013, ItemName), 8);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(TW_STR_00014, 8);
|
||
}
|
||
} else {
|
||
SUser.GiveItem(ItemId, 1);
|
||
SUser.SendNotiPacketMessage(TW_STR_00015, 8);
|
||
}
|
||
} else {
|
||
SUser.GiveItem(ItemId, 1);
|
||
SUser.SendNotiPacketMessage(TW_STR_00012, 8);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
//贪玩 时装回收卷
|
||
Cb_Use_Item_Sp_Func[TW_Avatar_RecTableStk] <- function(SUser, ItemId) {
|
||
SUser.GiveItem(ItemId, 1);
|
||
local Cid = SUser.GetCID();
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
local ItemObj = InvenObj.GetSlot(2, 0);
|
||
local Flag = false;
|
||
foreach(Infoobj in TW_Avatar_RecTable) {
|
||
local Info = clone(Infoobj);
|
||
if (ItemObj.GetIndex() == Info.S_Id) {
|
||
Flag = true;
|
||
ItemObj.Delete();
|
||
local Sql = "delete from taiwan_cain_2nd.user_items where charac_no=" + Cid + " and slot = 10;'";
|
||
Sq_MysqlExecNoRet(Sql);
|
||
SUser.SendItemSpace(1);
|
||
|
||
local ItemName = PvfItem.GetNameById(Info.S_Id);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00040, ItemName), 8);
|
||
|
||
foreach(io in Info.Stk) {
|
||
SUser.GiveItem(io.Id, io.Count);
|
||
}
|
||
}
|
||
}
|
||
if (!Flag) SUser.SendNotiPacketMessage(TW_STR_00039, 8);
|
||
}
|
||
}
|
||
|
||
|
||
//贪玩 宠物装备升级卷
|
||
foreach(_ItemId, baseInfo in TW_CreatureEqui_UpTable) {
|
||
local Info = clone(baseInfo);
|
||
Cb_Use_Item_Sp_Func[_ItemId] <- function(SUser, ItemId) {
|
||
local Cid = SUser.GetCID();
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
//是否拥有足够的材料
|
||
if (InvenObj.CheckArrItemCount(Info.Stk)) {
|
||
local ItemObj = InvenObj.GetSlot(3, 140);
|
||
|
||
if (ItemObj.GetIndex() == Info.S_Id) {
|
||
InvenObj.DeleteArrItemCount(Info.Stk);
|
||
local RandNum = MathClass.Rand(0, 100);
|
||
if (RandNum <= Info.Probability) {
|
||
ItemObj.Delete();
|
||
// local Sql = "delete from taiwan_cain_2nd.user_items where charac_no=" + Cid + " and slot = 10;'";
|
||
// Sq_MysqlExecNoRet(Sql);
|
||
SUser.SendItemSpace(0);
|
||
SUser.SendItemSpace(1);
|
||
SUser.SendItemSpace(2);
|
||
SUser.SendItemSpace(3);
|
||
SUser.SendItemSpace(4);
|
||
SUser.SendItemSpace(5);
|
||
SUser.SendItemSpace(6);
|
||
SUser.SendItemSpace(7);
|
||
SUser.GiveItem(Info.D_Id, 1);
|
||
local ItemName = PvfItem.GetNameById(Info.D_Id);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00025, ItemName), 8);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(TW_STR_00024, 8);
|
||
}
|
||
} else {
|
||
SUser.GiveItem(ItemId, 1);
|
||
SUser.SendNotiPacketMessage(TW_STR_00023, 8);
|
||
}
|
||
} else {
|
||
SUser.GiveItem(ItemId, 1);
|
||
SUser.SendNotiPacketMessage(TW_STR_00012, 8);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
//贪玩 宠物装备回收卷
|
||
Cb_Use_Item_Sp_Func[TW_CreatureEqui_RecTableStk] <- function(SUser, ItemId) {
|
||
SUser.GiveItem(ItemId, 1);
|
||
local Cid = SUser.GetCID();
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
local ItemObj = InvenObj.GetSlot(3, 140);
|
||
local Flag = false;
|
||
foreach(Infoobj in TW_CreatureEqui_RecTable) {
|
||
local Info = clone(Infoobj);
|
||
if (ItemObj.GetIndex() == Info.S_Id) {
|
||
Flag = true;
|
||
ItemObj.Delete();
|
||
// local Sql = "delete from taiwan_cain_2nd.user_items where charac_no=" + Cid + " and slot = 10;'";
|
||
// Sq_MysqlExecNoRet(Sql);
|
||
SUser.SendItemSpace(0);
|
||
SUser.SendItemSpace(1);
|
||
SUser.SendItemSpace(2);
|
||
SUser.SendItemSpace(3);
|
||
SUser.SendItemSpace(4);
|
||
SUser.SendItemSpace(5);
|
||
SUser.SendItemSpace(6);
|
||
SUser.SendItemSpace(7);
|
||
|
||
local ItemName = PvfItem.GetNameById(Info.S_Id);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00042, ItemName), 8);
|
||
|
||
foreach(io in Info.Stk) {
|
||
SUser.GiveItem(io.Id, io.Count);
|
||
}
|
||
}
|
||
}
|
||
if (!Flag) SUser.SendNotiPacketMessage(TW_STR_00041, 8);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
//贪玩 材料进阶卷
|
||
foreach(_ItemId, baseInfo in TW_StkUpJTable) {
|
||
local Info = clone(baseInfo);
|
||
Cb_Use_Item_Sp_Func[_ItemId] <- function(SUser, ItemId) {
|
||
local Cid = SUser.GetCID();
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
local GiveRate = 0;
|
||
local SlotIdx = InvenObj.GetSlotById(Info.Stk.Id);
|
||
if (SlotIdx != -1) {
|
||
local SlotItem = InvenObj.GetSlot(1, SlotIdx);
|
||
if (SlotItem) {
|
||
if (SlotItem.GetType() != "装备") {
|
||
local SlotCount = SlotItem.GetAdd_Info();
|
||
local GiveRate = floor(SlotCount.tofloat() / Info.Stk.Count.tofloat());
|
||
if(GiveRate < 1){
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00084), 8);
|
||
return false;
|
||
}
|
||
|
||
Sq_Inven_RemoveItemFormCount(InvenObj.C_Object, 1, SlotIdx, Info.Stk.Count * GiveRate, 10, 1);
|
||
SUser.SendUpdateItemList(1, 0, SlotIdx);
|
||
|
||
SUser.GiveItem(Info.D_Id, GiveRate);
|
||
local ItemName = PvfItem.GetNameById(Info.D_Id);
|
||
SUser.SendItemSpace(0);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00083, ItemName, GiveRate), 8);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
|
||
//贪玩 装备进阶卷
|
||
foreach(_ItemId, baseInfo in TW_EquipUpJTable) {
|
||
local Info = clone(baseInfo);
|
||
Cb_Use_Item_Sp_Func[_ItemId] <- function(SUser, ItemId) {
|
||
local Cid = SUser.GetCID();
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
//是否拥有足够的材料
|
||
if (InvenObj.CheckArrItemCount(Info.Stk)) {
|
||
local ItemObj = InvenObj.GetSlot(1, 9);
|
||
if (ItemObj.GetIndex() == Info.S_Id) {
|
||
InvenObj.DeleteArrItemCount(Info.Stk);
|
||
SUser.SendItemSpace(0);
|
||
local RandNum = MathClass.Rand(0, 100);
|
||
if (RandNum <= Info.Probability) {
|
||
ItemObj.Delete();
|
||
//强化等级
|
||
local UpgradeValue = ItemObj.GetUpgrade();
|
||
//增幅
|
||
local AmplificationValue = ItemObj.GetAmplification();
|
||
//锻造
|
||
local ForgingValue = ItemObj.GetForging();
|
||
//附魔
|
||
local EnchantingValue = ItemObj.GetEnchanting();
|
||
local AddItemInfo = SUser.GiveItem(Info.D_Id, 1);
|
||
local ItemName = PvfItem.GetNameById(Info.D_Id);
|
||
local NewAddItemObj = InvenObj.GetSlot(1, AddItemInfo[1]);
|
||
NewAddItemObj.SetUpgrade(UpgradeValue);
|
||
NewAddItemObj.SetAmplification(AmplificationValue);
|
||
NewAddItemObj.SetForging(ForgingValue);
|
||
NewAddItemObj.SetEnchanting(EnchantingValue);
|
||
NewAddItemObj.Flush();
|
||
SUser.SendItemSpace(0);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00044, ItemName), 8);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(TW_STR_00045, 8);
|
||
}
|
||
} else {
|
||
SUser.GiveItem(ItemId, 1);
|
||
SUser.SendNotiPacketMessage(TW_STR_00043, 8);
|
||
}
|
||
} else {
|
||
SUser.GiveItem(ItemId, 1);
|
||
SUser.SendNotiPacketMessage(TW_STR_00012, 8);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
//贪玩 一键使用道具
|
||
foreach(_ItemId, baseInfo in TW_OneUseTable) {
|
||
local Info = clone(baseInfo);
|
||
Cb_Use_Item_Sp_Func[_ItemId] <- function(SUser, ItemId) {
|
||
local Cid = SUser.GetCID();
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
local SlotIdx = InvenObj.GetSlotById(ItemId);
|
||
local ItemObj = InvenObj.GetSlot(1, SlotIdx);
|
||
|
||
local ItemCount = ItemObj.GetAdd_Info();
|
||
|
||
local GiveItemTableBuf = [];
|
||
|
||
for (local i = 0; i< Info.Stk.len(); i++) {
|
||
local T = {};
|
||
T.Id <- Info.Stk[i].Id;
|
||
if (T.Id != "金币" && T.Id != "点券" && T.Id != "代币") T.Count <- (ItemCount * Info.Stk[i].Count);
|
||
else {
|
||
T.MinCount <- (ItemCount * Info.Stk[i].MinCount);
|
||
T.MaxCount <- (ItemCount * Info.Stk[i].MaxCount);
|
||
}
|
||
GiveItemTableBuf.append(T);
|
||
}
|
||
|
||
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00047, PvfItem.GetNameById(ItemId), ItemCount), 8);
|
||
local mitems = {};
|
||
|
||
foreach(io in GiveItemTableBuf) {
|
||
if (io.Id == "点券") {
|
||
local RandCount = MathClass.Rand(io.MinCount, io.MaxCount);
|
||
SUser.RechargeCera(RandCount);
|
||
local GiveName = "";
|
||
if (type(io.Id) == "string") GiveName = io.Id;
|
||
else GiveName = PvfItem.GetNameById(io.Id);
|
||
SUser.SendNotiPacketMessage(format("[%s] %d", GiveName, RandCount), 8);
|
||
continue;
|
||
} else if (io.Id == "代币") {
|
||
local RandCount = MathClass.Rand(io.MinCount, io.MaxCount);
|
||
SUser.RechargeCeraPoint(RandCount);
|
||
local GiveName = "";
|
||
if (type(io.Id) == "string") GiveName = io.Id;
|
||
else GiveName = PvfItem.GetNameById(io.Id);
|
||
SUser.SendNotiPacketMessage(format("[%s] %d", GiveName, RandCount), 8);
|
||
continue;
|
||
} else if (io.Id == "金币") {
|
||
local RandCount = MathClass.Rand(io.MinCount, io.MaxCount);
|
||
Sq_CallFunc(S_Ptr("0x84FF29C"), "int", ["pointer", "int", "int", "int", "int"], Sq_CallFunc(S_Ptr("0x80DA28E"), "pointer", ["pointer"], SUser.C_Object), RandCount, 0, 0, 0);
|
||
local GiveName = "";
|
||
if (type(io.Id) == "string") GiveName = io.Id;
|
||
else GiveName = PvfItem.GetNameById(io.Id);
|
||
SUser.SendNotiPacketMessage(format("[%s] %d", GiveName, RandCount), 8);
|
||
continue;
|
||
} else {
|
||
local Ret = SUser.GiveItem(io.Id, io.Count);
|
||
if (!Ret) mitems[io.Id] <- (io.Count);
|
||
}
|
||
|
||
local GiveName = "";
|
||
if (type(io.Id) == "string") GiveName = io.Id;
|
||
else GiveName = PvfItem.GetNameById(io.Id);
|
||
SUser.SendNotiPacketMessage(format("[%s] %d", GiveName, io.Count), 8);
|
||
}
|
||
if (mitems.len() > 0) {
|
||
SUser.SendMail(mitems, {
|
||
Title = "系统",
|
||
Text = format(TW_STR_00046, PvfItem.GetNameById(ItemId)),
|
||
})
|
||
}
|
||
|
||
ItemObj.Delete();
|
||
SUser.GiveItem(ItemId, 1);
|
||
SUser.SendItemSpace(0);
|
||
|
||
SUser.SendNotiPacketMessage(" ", 8);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
//贪玩 一键使用道具
|
||
Cb_Use_Item_Sp_Func[TW_BoxId] <- function(SUser, ItemId) {
|
||
local Cid = SUser.GetCID();
|
||
local InvenObj = SUser.GetInven();
|
||
if (InvenObj) {
|
||
local SlotIdx = InvenObj.GetSlotById(ItemId);
|
||
local ItemObj = InvenObj.GetSlot(1, SlotIdx);
|
||
//获得道具数量
|
||
local ItemCount = ItemObj.GetAdd_Info();
|
||
//本次真实使用数量
|
||
local UseCount = 0;
|
||
if (ItemCount< 10) UseCount = ItemCount;
|
||
else if (ItemCount >= 10 && ItemCount< 500) UseCount = 10;
|
||
else if (ItemCount >= 500) UseCount = 20;
|
||
|
||
local GiveItemTable = {};
|
||
for (local us = 0; us< UseCount; us++) {
|
||
for (local i = 0; i< TW_Box_Group; i++) {
|
||
local GroupConfig = getroottable()["TW_Box_Reward_" + i];
|
||
|
||
//遍历编号表
|
||
local RandArr = [0];
|
||
//开始计算第一个道具的补全几率
|
||
local OneIdexProbability = 0.0;
|
||
for (local z = 1; z< GroupConfig.len(); z++) {
|
||
OneIdexProbability += (GroupConfig[z][1] * 100000);
|
||
RandArr.append(GroupConfig[z][1] * 100000);
|
||
}
|
||
OneIdexProbability = (100000 - OneIdexProbability);
|
||
RandArr[0] = OneIdexProbability;
|
||
|
||
//取随机数
|
||
local RandNum = MathClass.Rand(0, 100000);
|
||
local RandAddFlag = 0;
|
||
for (local q = 0; q< RandArr.len(); q++) {
|
||
RandAddFlag += RandArr[q];
|
||
if (RandNum< RandAddFlag) {
|
||
local Name = GroupConfig[q][4];
|
||
local Noti = GroupConfig[q][5];
|
||
local Id = GroupConfig[q][0];
|
||
local Count = MathClass.Rand(GroupConfig[q][2], GroupConfig[q][3]);
|
||
if (GiveItemTable.rawin(Id)) {
|
||
GiveItemTable[Id].Count += Count;
|
||
} else {
|
||
GiveItemTable[Id] <- {};
|
||
GiveItemTable[Id].Count <- Count;
|
||
GiveItemTable[Id].Name <- Name;
|
||
GiveItemTable[Id].Noti <- Noti;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
local mitems = {};
|
||
//播报
|
||
local UseName = PvfItem.GetNameById(ItemId);
|
||
SUser.SendNotiPacketMessage(format(TW_BoxStr_0, UseCount, UseName), 6);
|
||
SUser.SendNotiPacketMessage(" ", 6);
|
||
SUser.SendNotiPacketMessage(TW_BoxStr_1, 6);
|
||
foreach(Id, Info in GiveItemTable) {
|
||
// SUser.SendNotiPacketMessage(format(TW_BoxStr_2, Info.Name, Info.Count), 6);
|
||
SUser.SendNotiForColorAIdPacketMessage([
|
||
[" → ", 0, [0xff, 0xff, 0xff]],
|
||
[Info.Name, 1, TW_BoxStr_2_Color, Id],
|
||
[" x" + Info.Count.tostring(), 0, [0xff, 0xff, 0xff]]
|
||
], 6);
|
||
|
||
if (Info.Noti) {
|
||
local NotIInfo = TW_BoxStr_5[MathClass.Rand(0, TW_BoxStr_5.len())];
|
||
// print("要播报全服公告: " + Info.Name);
|
||
World.SendNotiForColorAIdPacketMessage([
|
||
[SUser.GetCharacName(), 1, TW_BoxStr_4_Color, null],
|
||
[NotIInfo[0], 0, [0xff, 0xff, 0xff]],
|
||
[UseName, 1, TW_BoxStr_7_Color, ItemId],
|
||
[NotIInfo[1], 0, [0xff, 0xff, 0xff]],
|
||
[Info.Count.tostring(), 0, [0xff, 0xff, 0xff]],
|
||
[NotIInfo[2], 0, [0xff, 0xff, 0xff]],
|
||
[Info.Name, 1, TW_BoxStr_6_Color, Id],
|
||
[NotIInfo[3], 0, [0xff, 0xff, 0xff]],
|
||
], 14);
|
||
}
|
||
|
||
local Ret = SUser.GiveItem(Id, Info.Count);
|
||
if (!Ret) mitems[Id] <- (Info.Count);
|
||
}
|
||
|
||
if (mitems.len() > 0) {
|
||
SUser.SendMail(mitems, {
|
||
Title = "系统",
|
||
Text = format(TW_BoxStr_3, PvfItem.GetNameById(ItemId)),
|
||
})
|
||
}
|
||
|
||
InvenObj.DeleteItemCount(ItemId, UseCount - 1);
|
||
SUser.SendItemSpace(0);
|
||
|
||
SUser.SendNotiPacketMessage(" ", 6);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
//获取我的的分解提升率
|
||
function Get_MyDisjointRate(SUser) {
|
||
//装备提升率
|
||
local Equrate = 0;
|
||
//消耗品提升率
|
||
local Stkrate = 0;
|
||
//获取背包对象
|
||
local InvenObj = SUser.GetInven();
|
||
//遍历身上的每一件装备
|
||
for (local u = 0; u <= 26; u++) {
|
||
//如果装备存在 并且存在于 加成表中 就给提升率加上对应的值
|
||
local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u);
|
||
if (EquObj && !EquObj.IsEmpty) {
|
||
local EquObjId = EquObj.GetIndex();
|
||
if (TW_UpRateEqu.rawin(EquObjId)) {
|
||
Equrate += TW_UpRateEqu[EquObjId];
|
||
}
|
||
}
|
||
}
|
||
//遍历背包每一个道具
|
||
for (local y = 57; y <= 250; y++) {
|
||
local StkObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, y);
|
||
if (StkObj && !StkObj.IsEmpty) {
|
||
local StkObjId = StkObj.GetIndex();
|
||
if (TW_UpRateStk.rawin(StkObjId)) {
|
||
Stkrate += (TW_UpRateStk[StkObjId] * StkObj.GetAdd_Info());
|
||
}
|
||
}
|
||
}
|
||
return {
|
||
EquRate = Equrate,
|
||
StkRate = Stkrate
|
||
};
|
||
}
|
||
//获取分解应该获得多少道具
|
||
function Get_Disjonint(Level, Rarity, isKeyHit) {
|
||
local T = null;
|
||
//根据是否暴击决定从那张表里读
|
||
if (!isKeyHit) {
|
||
T = TW_BaseTab[Rarity];
|
||
} else {
|
||
T = TW_KeyHitTab[Rarity];
|
||
}
|
||
//遍历表 找到对应的等级
|
||
foreach(i, v in T) {
|
||
if (Level< i) {
|
||
local rettab = [];
|
||
foreach(qi, qv in v) {
|
||
if (MathClass.Rand(0, 100) <= qv["rate"]) {
|
||
if ("itempack" in qv) {
|
||
local idx = MathClass.Rand(1, qv["itempack"].len());
|
||
rettab.append({
|
||
id = qv["itempack"][idx]["itemid"],
|
||
count = qv["itempack"][idx]["itemcount"] + MathClass.Rand(0, qv["itempack"][idx]["itemredom"]),
|
||
uprate = qv["uprate"]
|
||
});
|
||
} else {
|
||
rettab.append({
|
||
id = qv["itemid"],
|
||
count = qv["itemcount"] + MathClass.Rand(0, qv["itemredom"]),
|
||
uprate = qv["uprate"]
|
||
});
|
||
}
|
||
}
|
||
}
|
||
return rettab;
|
||
}
|
||
}
|
||
}
|
||
|
||
function TW_FenjieFunc(SUser) {
|
||
local RateObj = Get_MyDisjointRate(SUser);
|
||
local rate = (RateObj.EquRate + RateObj.StkRate).tofloat() / 100.0 + 1.0;
|
||
local upcount = 0;
|
||
if ((rate * 100) % 100 > 0) {
|
||
upcount = 0;
|
||
}
|
||
local NotiTable = {};
|
||
//获取背包对象
|
||
local InvenObj = SUser.GetInven();
|
||
//遍历装备栏
|
||
for (local u = 0; u< 48; u++) {
|
||
local iitem = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, u + 9);;
|
||
//如果道具存在且不为空 并且不是不可分解的道具
|
||
if (iitem && !iitem.IsEmpty && !(TW_NoDisjoint.rawin(iitem.GetIndex()))) {
|
||
local isKeyHit = false;
|
||
//判定是否暴击
|
||
if (MathClass.Rand(0, 100) <= TW_KeyHit) {
|
||
isKeyHit = true;
|
||
}
|
||
//拿到PVF数据
|
||
local PvfItemObj = PvfItem.GetPvfItemById(iitem.GetIndex());
|
||
//根据使用登记 和 稀有度 已经是否暴击获得奖励表
|
||
local GiveTab = Get_Disjonint(PvfItemObj.GetUsableLevel(), PvfItemObj.GetRarity(), isKeyHit);
|
||
//获取装备名称
|
||
local name = PvfItemObj.GetName();
|
||
//删除该道具
|
||
iitem.Delete();
|
||
//刷新背包
|
||
SUser.SendItemSpace(0);
|
||
local mitems = {};
|
||
SUser.SendNotiPacketMessage("分解 [" + name + "]", 7);
|
||
foreach(i, v in GiveTab) {
|
||
//真实倍率
|
||
local realrate = rate;
|
||
if (v.uprate == 0) {
|
||
realrate = 1.0;
|
||
upcount = 0;
|
||
}
|
||
local Ret = SUser.GiveItem(v.id, (v.count * realrate + upcount));
|
||
if (Ret) {
|
||
local RewordName = PvfItemObj.GetNameById(v.id);
|
||
//第一个道具的时候要播报头
|
||
if (i == 0) {
|
||
SUser.SendNotiPacketMessage("获得 [" + RewordName + "] " + (v.count * realrate + upcount).tointeger() + "个", 7);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(" [" + RewordName + "] " + (v.count * realrate + upcount).tointeger() + "个", 7);
|
||
}
|
||
if (NotiTable.rawin(v.id)) {
|
||
NotiTable[v.id] += (v.count * realrate + upcount);
|
||
} else {
|
||
NotiTable[v.id] <- (v.count * realrate + upcount);
|
||
}
|
||
} else {
|
||
SUser.SendNotiPacketMessage(" 背包已满,此材料通过邮寄至邮箱,小退领取。", 7);
|
||
mitems[v.id] <- (v.count * realrate + upcount);
|
||
}
|
||
}
|
||
if (mitems.len() > 0) {
|
||
SUser.SendMail(mitems, {
|
||
Title = "系统",
|
||
Text = "由于你的包裹已满, 请留出足够的空间来接收道具."
|
||
})
|
||
}
|
||
SUser.SendNotiPacketMessage("\n", 7);
|
||
}
|
||
}
|
||
SUser.SendItemSpace(0);
|
||
SUser.SendNotiPacketMessage(" ", 8);
|
||
SUser.SendNotiPacketMessage(TW_STR_00033, 8);
|
||
SUser.SendNotiPacketMessage(TW_STR_00034, 8);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00035, RateObj.StkRate, RateObj.EquRate), 8);
|
||
SUser.SendNotiPacketMessage(TW_STR_00036, 8);
|
||
|
||
if (NotiTable.len() > 0) {
|
||
SUser.SendNotiPacketMessage("获得 :", 8);
|
||
foreach(i, v in NotiTable) {
|
||
SUser.SendNotiPacketMessage("[" + PvfItem.GetNameById(i) + "] " + v.tointeger() + "个", 8);
|
||
}
|
||
} else {
|
||
SUser.SendNotiPacketMessage("本次没有分解任何装备", 8);
|
||
}
|
||
// SUser.SendNotiPacketMessage(" ", 8);
|
||
// SUser.SendNotiPacketMessage("装备分解量加成 : " + RateObj.EquRate + "% 道具分解量加成 : " + RateObj.StkRate + "%", 8);
|
||
// SUser.SendNotiPacketMessage(" ", 8);
|
||
}
|
||
|
||
|
||
function TW_HuishouFunc(SUser) {
|
||
local rate = 1.0;
|
||
local upcount = 0;
|
||
|
||
if (rate != 1.0) {
|
||
upcount = 1;
|
||
}
|
||
|
||
local NotiTable = {};
|
||
local NotiTableP = {};
|
||
local NotiTableC = {};
|
||
|
||
//获取背包对象
|
||
local InvenObj = SUser.GetInven();
|
||
|
||
for (local u = 0; u <= 350; u++) {
|
||
local iitem = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, u);
|
||
|
||
if (iitem) {
|
||
local Id = iitem.GetIndex();
|
||
local Count = iitem.GetAdd_Info();
|
||
//获取名字
|
||
local name = PvfItem.GetNameById(Id);
|
||
if (u >= 9 && u <= 40) Count = 1;
|
||
|
||
|
||
if (TW_Recovery.rawin(Id)) {
|
||
SUser.SendNotiPacketMessage("回收 [" + name + "] " + Count + "个", 6);
|
||
|
||
local mitems = {};
|
||
|
||
foreach(i, v in TW_Recovery[Id]) {
|
||
local Ret = SUser.GiveItem(v[0], (v[1] * rate * Count) + upcount);
|
||
if (Ret) {
|
||
local RewordName = PvfItem.GetNameById(v[0]);
|
||
|
||
if (i == 0) {
|
||
SUser.SendNotiPacketMessage("获得 [" + RewordName + "] " + (v[1] * rate * Count) + upcount + "个", 6);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(" [" + RewordName + "] " + (v[1] * rate * Count + upcount) + "个", 6);
|
||
}
|
||
|
||
if (NotiTable.rawin(RewordName)) {
|
||
NotiTable[RewordName] += (v[1] * rate * Count) + upcount;
|
||
} else {
|
||
NotiTable[RewordName] <- (v[1] * rate * Count) + upcount;
|
||
}
|
||
} else {
|
||
SUser.SendNotiPacketMessage(" 背包已满,此材料通过邮寄至邮箱,小退领取。", 6);
|
||
mitems[v[0]] <- (v[1] * rate * Count) + upcount;
|
||
}
|
||
}
|
||
|
||
SUser.SendNotiPacketMessage(" ", 8);
|
||
|
||
if (mitems.len() > 0) {
|
||
SUser.SendMail(mitems, {
|
||
Title = TW_STR_00001,
|
||
Text = TW_STR_00002
|
||
})
|
||
}
|
||
InvenObj.DeleteItemCount(Id, Count);
|
||
}
|
||
//回收给点券
|
||
else if (TW_RecoveryP.rawin(Id)) {
|
||
if (NotiTableP.rawin("点券")) {
|
||
NotiTableP["点券"] += TW_RecoveryP[Id] * Count;
|
||
} else {
|
||
NotiTableP["点券"] <- TW_RecoveryP[Id] * Count;
|
||
}
|
||
|
||
SUser.SendNotiPacketMessage("回收 [" + name + "] " + Count + "个", 6);
|
||
SUser.RechargeCera(TW_RecoveryP[Id] * Count);
|
||
InvenObj.DeleteItemCount(Id, Count);
|
||
}
|
||
//回收给代币券
|
||
else if (TW_RecoveryC.rawin(Id)) {
|
||
if (NotiTableC.rawin("代币")) {
|
||
NotiTableC["代币"] += TW_RecoveryC[Id] * Count;
|
||
} else {
|
||
NotiTableC["代币"] <- TW_RecoveryC[Id] * Count;
|
||
}
|
||
|
||
SUser.SendNotiPacketMessage("回收 [" + name + "] " + Count + "个", 6);
|
||
SUser.RechargeCeraPoint(TW_RecoveryC[Id] * Count);
|
||
InvenObj.DeleteItemCount(Id, Count);
|
||
}
|
||
}
|
||
}
|
||
|
||
SUser.SendItemSpace(0);
|
||
SUser.SendNotiPacketMessage(" ", 8);
|
||
SUser.SendNotiPacketMessage("本次回收已完成", 8);
|
||
SUser.SendNotiPacketMessage(" ", 8);
|
||
|
||
if (NotiTableP.len() > 0 || NotiTable.len() > 0 || NotiTableC.len() > 0) {
|
||
SUser.SendNotiPacketMessage("获得道具 :", 8);
|
||
}
|
||
|
||
if (NotiTableP.len() > 0) {
|
||
SUser.SendNotiPacketMessage("[点券] " + NotiTableP["点券"] + "点", 8);
|
||
}
|
||
|
||
if (NotiTableC.len() > 0) {
|
||
SUser.SendNotiPacketMessage("[代币] " + NotiTableC["代币"] + "点", 8);
|
||
}
|
||
|
||
if (NotiTable.len() > 0) {
|
||
foreach(i, v in NotiTable) {
|
||
SUser.SendNotiPacketMessage("[" + i + "] " + v + "个", 8);
|
||
}
|
||
}
|
||
|
||
if (NotiTableP.len() == 0 && NotiTable.len() == 0 && NotiTableC.len() == 0) {
|
||
SUser.SendNotiPacketMessage("本次没有回收任何道具", 8);
|
||
}
|
||
|
||
SUser.SendNotiPacketMessage(" ", 8);
|
||
|
||
}
|
||
|
||
//贪玩一键分解卷轴
|
||
Cb_Use_Item_Sp_Func[TW_DisjointItemId] <- function(SUser, ItemId) {
|
||
SUser.GiveItem(ItemId, 1);
|
||
TW_FenjieFunc(SUser);
|
||
}
|
||
//贪玩一键回收卷轴
|
||
Cb_Use_Item_Sp_Func[TW_RecoveryItemId] <- function(SUser, ItemId) {
|
||
SUser.GiveItem(ItemId, 1);
|
||
TW_HuishouFunc(SUser);
|
||
}
|
||
|
||
//在副本中的人
|
||
TW_UserOpenDgnTab <- {}
|
||
Cb_History_DungeonEnter_Func["TW_DungeonEnter"] <- function(SUser, Data) {
|
||
//进入副本就把这人存下来
|
||
TW_UserOpenDgnTab[SUser.GetCID()] <- {
|
||
Dgnname = Data[14],
|
||
ItemCount = 0,
|
||
ItemStkCount = {},
|
||
ItemUprateStkTab = {}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
//获取我的的地下城爆率提升率
|
||
function Get_MyDgnRate(SUser, DgnName) {
|
||
//装备金币提升率
|
||
local Equ_Gold_rate = 0;
|
||
//装备道具提升率
|
||
local Equ_Item_rate = 0;
|
||
//时装金币提升率
|
||
local Ava_Gold_rate = 0;
|
||
//时装道具提升率
|
||
local Ava_Item_rate = 0;
|
||
//宠物金币提升率
|
||
local Cre_Gold_rate = 0;
|
||
//宠物道具提升率
|
||
local Cre_Item_rate = 0;
|
||
//道具金币提升率
|
||
local Stk_Gold_rate = 0;
|
||
//道具道具提升率
|
||
local Stk_Item_rate = 0;
|
||
local KeyUp = {};
|
||
|
||
//获取背包对象
|
||
local InvenObj = SUser.GetInven();
|
||
//遍历身上的每一件装备
|
||
for (local u = 10; u <= 22; u++) {
|
||
//如果装备存在 并且存在于 加成表中 就给提升率加上对应的值
|
||
local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u);
|
||
if (EquObj && !EquObj.IsEmpty) {
|
||
local EquObjId = EquObj.GetIndex();
|
||
if (TW_GoldUpRateTab.rawin(EquObjId)) {
|
||
if (TW_DgnUpRateItemTab[DgnName].rawin(EquObjId)) {
|
||
if (!(KeyUp.rawin(TW_GoldUpRateTab[EquObjId].key))) {
|
||
Equ_Gold_rate += TW_GoldUpRateTab[EquObjId].rate;
|
||
KeyUp[TW_GoldUpRateTab[EquObjId].key] <- TW_GoldUpRateTab[EquObjId].rate;
|
||
} else {
|
||
if (KeyUp[TW_GoldUpRateTab[EquObjId].key] > TW_GoldUpRateTab[EquObjId].rate) {
|
||
|
||
} else {
|
||
Equ_Gold_rate -= KeyUp[TW_GoldUpRateTab[EquObjId].key];
|
||
Equ_Gold_rate += TW_GoldUpRateTab[EquObjId].rate;
|
||
KeyUp[TW_GoldUpRateTab[EquObjId].key] <- TW_GoldUpRateTab[EquObjId].rate;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (TW_UpRateTab.rawin(EquObjId)) {
|
||
if (TW_DgnUpRateItemTab[DgnName].rawin(EquObjId)) {
|
||
if (!(KeyUp.rawin(TW_UpRateTab[EquObjId].key))) {
|
||
Equ_Item_rate += TW_UpRateTab[EquObjId].rate;
|
||
KeyUp[TW_UpRateTab[EquObjId].key] <- TW_UpRateTab[EquObjId].rate;
|
||
} else {
|
||
if (KeyUp[TW_UpRateTab[EquObjId].key] > TW_UpRateTab[EquObjId].rate) {
|
||
|
||
} else {
|
||
Equ_Item_rate -= KeyUp[TW_UpRateTab[EquObjId].key];
|
||
Equ_Item_rate += TW_UpRateTab[EquObjId].rate;
|
||
KeyUp[TW_UpRateTab[EquObjId].key] <- TW_UpRateTab[EquObjId].rate;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
//遍历身上的每一件装备
|
||
for (local u = 0; u <= 10; u++) {
|
||
//如果装备存在 并且存在于 加成表中 就给提升率加上对应的值
|
||
local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u);
|
||
if (EquObj && !EquObj.IsEmpty) {
|
||
local EquObjId = EquObj.GetIndex();
|
||
if (TW_GoldUpRateTab.rawin(EquObjId)) {
|
||
if (TW_DgnUpRateItemTab[DgnName].rawin(EquObjId)) {
|
||
if (!(KeyUp.rawin(TW_GoldUpRateTab[EquObjId].key))) {
|
||
Ava_Gold_rate += TW_GoldUpRateTab[EquObjId].rate;
|
||
KeyUp[TW_GoldUpRateTab[EquObjId].key] <- TW_GoldUpRateTab[EquObjId].rate;
|
||
} else {
|
||
if (KeyUp[TW_GoldUpRateTab[EquObjId].key] > TW_GoldUpRateTab[EquObjId].rate) {
|
||
|
||
} else {
|
||
Ava_Gold_rate -= KeyUp[TW_GoldUpRateTab[EquObjId].key];
|
||
Ava_Gold_rate += TW_GoldUpRateTab[EquObjId].rate;
|
||
KeyUp[TW_GoldUpRateTab[EquObjId].key] <- TW_GoldUpRateTab[EquObjId].rate;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (TW_UpRateTab.rawin(EquObjId)) {
|
||
if (TW_DgnUpRateItemTab[DgnName].rawin(EquObjId)) {
|
||
if (!(KeyUp.rawin(TW_UpRateTab[EquObjId].key))) {
|
||
Ava_Item_rate += TW_UpRateTab[EquObjId].rate;
|
||
KeyUp[TW_UpRateTab[EquObjId].key] <- TW_UpRateTab[EquObjId].rate;
|
||
} else {
|
||
if (KeyUp[TW_UpRateTab[EquObjId].key] > TW_UpRateTab[EquObjId].rate) {
|
||
|
||
} else {
|
||
Ava_Item_rate -= KeyUp[TW_UpRateTab[EquObjId].key];
|
||
Ava_Item_rate += TW_UpRateTab[EquObjId].rate;
|
||
KeyUp[TW_UpRateTab[EquObjId].key] <- TW_UpRateTab[EquObjId].rate;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
//遍历身上的每一件装备
|
||
for (local u = 22; u <= 26; u++) {
|
||
//如果装备存在 并且存在于 加成表中 就给提升率加上对应的值
|
||
local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u);
|
||
if (EquObj && !EquObj.IsEmpty) {
|
||
local EquObjId = EquObj.GetIndex();
|
||
if (TW_GoldUpRateTab.rawin(EquObjId)) {
|
||
if (TW_DgnUpRateItemTab[DgnName].rawin(EquObjId)) {
|
||
if (!(KeyUp.rawin(TW_GoldUpRateTab[EquObjId].key))) {
|
||
Cre_Gold_rate += TW_GoldUpRateTab[EquObjId].rate;
|
||
KeyUp[TW_GoldUpRateTab[EquObjId].key] <- TW_GoldUpRateTab[EquObjId].rate;
|
||
} else {
|
||
if (KeyUp[TW_GoldUpRateTab[EquObjId].key] > TW_GoldUpRateTab[EquObjId].rate) {
|
||
|
||
} else {
|
||
Cre_Gold_rate -= KeyUp[TW_GoldUpRateTab[EquObjId].key];
|
||
Cre_Gold_rate += TW_GoldUpRateTab[EquObjId].rate;
|
||
KeyUp[TW_GoldUpRateTab[EquObjId].key] <- TW_GoldUpRateTab[EquObjId].rate;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (TW_UpRateTab.rawin(EquObjId)) {
|
||
if (TW_DgnUpRateItemTab[DgnName].rawin(EquObjId)) {
|
||
if (!(KeyUp.rawin(TW_UpRateTab[EquObjId].key))) {
|
||
Cre_Item_rate += TW_UpRateTab[EquObjId].rate;
|
||
KeyUp[TW_UpRateTab[EquObjId].key] <- TW_UpRateTab[EquObjId].rate;
|
||
} else {
|
||
if (KeyUp[TW_UpRateTab[EquObjId].key] > TW_UpRateTab[EquObjId].rate) {
|
||
|
||
} else {
|
||
Cre_Item_rate -= KeyUp[TW_UpRateTab[EquObjId].key];
|
||
Cre_Item_rate += TW_UpRateTab[EquObjId].rate;
|
||
KeyUp[TW_UpRateTab[EquObjId].key] <- TW_UpRateTab[EquObjId].rate;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
//遍历背包每一个道具
|
||
for (local y = 57; y <= 250; y++) {
|
||
local StkObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, y);
|
||
if (StkObj && !StkObj.IsEmpty) {
|
||
local EquObjId = StkObj.GetIndex();
|
||
|
||
if (TW_GoldUpRateTab.rawin(EquObjId)) {
|
||
if (TW_DgnUpRateItemTab[DgnName].rawin(EquObjId)) {
|
||
if (!(KeyUp.rawin(TW_GoldUpRateTab[EquObjId].key))) {
|
||
Stk_Gold_rate += (TW_GoldUpRateTab[EquObjId].rate * StkObj.GetAdd_Info());
|
||
KeyUp[TW_GoldUpRateTab[EquObjId].key] <- (TW_GoldUpRateTab[EquObjId].rate * StkObj.GetAdd_Info());
|
||
} else {
|
||
if (KeyUp[TW_GoldUpRateTab[EquObjId].key] > (TW_GoldUpRateTab[EquObjId].rate * StkObj.GetAdd_Info())) {
|
||
|
||
} else {
|
||
Stk_Gold_rate -= KeyUp[TW_GoldUpRateTab[EquObjId].key];
|
||
Stk_Gold_rate += (TW_GoldUpRateTab[EquObjId].rate * StkObj.GetAdd_Info());
|
||
KeyUp[TW_GoldUpRateTab[EquObjId].key] <- (TW_GoldUpRateTab[EquObjId].rate * StkObj.GetAdd_Info());
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
if (TW_UpRateTab.rawin(EquObjId)) {
|
||
if (TW_DgnUpRateItemTab[DgnName].rawin(EquObjId)) {
|
||
if (!(KeyUp.rawin(TW_UpRateTab[EquObjId].key))) {
|
||
Stk_Item_rate += (TW_UpRateTab[EquObjId].rate * StkObj.GetAdd_Info());
|
||
KeyUp[TW_UpRateTab[EquObjId].key] <- (TW_UpRateTab[EquObjId].rate * StkObj.GetAdd_Info());
|
||
} else {
|
||
if (KeyUp[TW_UpRateTab[EquObjId].key] > (TW_UpRateTab[EquObjId].rate * StkObj.GetAdd_Info())) {
|
||
|
||
} else {
|
||
Stk_Item_rate -= KeyUp[TW_UpRateTab[EquObjId].key];
|
||
Stk_Item_rate += (TW_UpRateTab[EquObjId].rate * StkObj.GetAdd_Info());
|
||
KeyUp[TW_UpRateTab[EquObjId].key] <- (TW_UpRateTab[EquObjId].rate * StkObj.GetAdd_Info());
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return {
|
||
//装备金币提升率
|
||
Equ_Gold = Equ_Gold_rate,
|
||
//装备道具提升率
|
||
Equ_Item = Equ_Item_rate,
|
||
//时装金币提升率
|
||
Ava_Gold = Ava_Gold_rate,
|
||
//时装道具提升率
|
||
Ava_Item = Ava_Item_rate,
|
||
//宠物金币提升率
|
||
Cre_Gold = Cre_Gold_rate,
|
||
//宠物道具提升率
|
||
Cre_Item = Cre_Item_rate,
|
||
//道具金币提升率
|
||
Stk_Gold = Stk_Gold_rate,
|
||
//道具道具提升率
|
||
Stk_Item = Stk_Item_rate
|
||
};
|
||
}
|
||
|
||
Cb_History_DungeonLeave_Func["TW_DungeonLeave"] <- function(SUser, Data) {
|
||
//获取名字
|
||
local UserName = SUser.GetCharacName();
|
||
local CID = SUser.GetCID();
|
||
if (TW_UserOpenDgnTab.rawin(CID)) {
|
||
// SUser.SendItemSpace(0);
|
||
|
||
local UserOpenDgnObj = TW_UserOpenDgnTab[CID];
|
||
local pssdd = UserOpenDgnObj.ItemUprateStkTab.len();
|
||
local DgnName = UserOpenDgnObj.Dgnname.slice(1, UserOpenDgnObj.Dgnname.len() - 1);
|
||
local userupraterate = 0;
|
||
local usergoldupraterate = 0;
|
||
|
||
local userupraterateKeyTab = {};
|
||
local usergoldupraterateKeyTab = {};
|
||
|
||
local userupraterateKeyStringTab = {};
|
||
local usergoldupraterateKeyStringTab = {};
|
||
|
||
|
||
if (pssdd > 0) {
|
||
|
||
// //获取背包对象
|
||
// local InvenObj = SUser.GetInven();
|
||
// for (local u = 49; u <= 350; u++) {
|
||
// local iitem = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, u);
|
||
// if (iitem) {
|
||
// if (TW_DgnUpRateItemTab.rawin(DgnName)) {
|
||
// local addbuf = 0;
|
||
// local goldaddbuf = 0;
|
||
// if (TW_UpRateTab.rawin(iitem.GetIndex())) addbuf = TW_UpRateTab[iitem.GetIndex()];
|
||
// if (TW_GoldUpRateTab.rawin(iitem.GetIndex())) goldaddbuf = TW_GoldUpRateTab[iitem.GetIndex()];
|
||
// if (addbuf || goldaddbuf) {
|
||
// if (TW_DgnUpRateItemTab[DgnName].rawin(iitem.GetIndex())) {
|
||
// if (userupraterate == 0 && usergoldupraterate == 0) {
|
||
// SUser.SendNotiPacketMessage(" ", 7);
|
||
// SUser.SendNotiPacketMessage("挑战 [" + DgnName + "] 已完成", 7);
|
||
// }
|
||
// if (addbuf && !(userupraterateKeyTab.rawin(addbuf.key))) {
|
||
// userupraterateKeyStringTab[addbuf.key] <- "拥有 [" + TW_UpRateTab[iitem.GetIndex()].name + "] 触发 [" + ((TW_UpRateTab[iitem.GetIndex()].rate - 1) * 100) + "%] 道具奖励";
|
||
// userupraterate += (addbuf.rate - 1);
|
||
// userupraterateKeyTab[addbuf.key] <- (addbuf.rate - 1);
|
||
// } else {
|
||
// if (addbuf) {
|
||
// if (addbuf.rate >= userupraterateKeyTab[addbuf.key]) {
|
||
// userupraterateKeyStringTab[addbuf.key] <- "拥有 [" + TW_UpRateTab[iitem.GetIndex()].name + "] 触发 [" + ((TW_UpRateTab[iitem.GetIndex()].rate - 1) * 100) + "%] 道具奖励";
|
||
// userupraterate -= userupraterateKeyTab[addbuf.key];
|
||
// userupraterate += (addbuf.rate - 1);
|
||
// userupraterateKeyTab[addbuf.key] = (addbuf.rate - 1);
|
||
// }
|
||
// }
|
||
// }
|
||
// if (goldaddbuf && !(usergoldupraterateKeyTab.rawin(goldaddbuf.key))) {
|
||
// usergoldupraterateKeyStringTab[goldaddbuf.key] <- "拥有 [" +
|
||
// TW_GoldUpRateTab[iitem.GetIndex()].name +
|
||
// "] 触发 [" + (TW_GoldUpRateTab[iitem.GetIndex()].rate) +
|
||
// "%] 金币奖励";
|
||
// usergoldupraterate += goldaddbuf.rate;
|
||
// usergoldupraterateKeyTab[goldaddbuf.key] <- goldaddbuf.rate;
|
||
// } else {
|
||
// if (goldaddbuf) {
|
||
// if (usergoldupraterateKeyTab.rawin(goldaddbuf.key)) {
|
||
// if (goldaddbuf.rate >= usergoldupraterateKeyTab[goldaddbuf.key]) {
|
||
// usergoldupraterateKeyStringTab[goldaddbuf.key] = "拥有 [" + TW_GoldUpRateTab[iitem.GetIndex()].name + "] 触发 [" + (TW_GoldUpRateTab[iitem.GetIndex()].rate) + "%] 金币奖励";
|
||
// usergoldupraterate -= usergoldupraterateKeyTab[goldaddbuf.key];
|
||
// usergoldupraterate += goldaddbuf.rate;
|
||
// usergoldupraterateKeyTab[goldaddbuf.key] = goldaddbuf.rate;
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
|
||
// //遍历身上的每一件装备
|
||
// for (local u = 0; u <= 26; u++) {
|
||
// //如果装备存在 并且存在于 加成表中 就给提升率加上对应的值
|
||
// local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u);
|
||
// if (EquObj && !EquObj.IsEmpty) {
|
||
// local EquObjId = EquObj.GetIndex();
|
||
// if (TW_UpRateEqu.rawin(EquObjId)) {
|
||
// // Equrate += TW_UpRateEqu[EquObjId];
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
|
||
/*
|
||
return {
|
||
//装备金币提升率
|
||
Equ_Gold = Equ_Gold_rate;
|
||
//装备道具提升率
|
||
Equ_Item = Equ_Item_rate;
|
||
//时装金币提升率
|
||
Ava_Gold = Ava_Gold_rate;
|
||
//时装道具提升率
|
||
Ava_Item = Ava_Item_rate;
|
||
//宠物金币提升率
|
||
Cre_Gold = Cre_Gold_rate;
|
||
//宠物道具提升率
|
||
Cre_Item = Cre_Item_rate;
|
||
//道具金币提升率
|
||
Stk_Gold = Stk_Gold_rate;
|
||
//道具道具提升率
|
||
Stk_Item = Stk_Item_rate;
|
||
};
|
||
*/
|
||
|
||
if (TW_DgnUpRateItemTab.rawin(DgnName)) {
|
||
|
||
local RateObj = Get_MyDgnRate(SUser, DgnName);
|
||
userupraterate = (RateObj.Equ_Item + RateObj.Ava_Item + RateObj.Cre_Item + RateObj.Stk_Item).tofloat() / 100.0;
|
||
usergoldupraterate = (RateObj.Equ_Gold + RateObj.Ava_Gold + RateObj.Cre_Gold + RateObj.Stk_Gold).tofloat() / 100.0;
|
||
|
||
SUser.SendNotiPacketMessage(" ", 7);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00026, DgnName), 7);
|
||
SUser.SendNotiPacketMessage(TW_STR_00027, 7);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00028, RateObj.Equ_Gold, RateObj.Equ_Item), 7);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00029, RateObj.Stk_Gold, RateObj.Stk_Item), 7);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00030, RateObj.Ava_Gold, RateObj.Ava_Item), 7);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00031, RateObj.Cre_Gold, RateObj.Cre_Item), 7);
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00032, DgnName), 7);
|
||
|
||
if (userupraterate > 0 || usergoldupraterate > 0) {
|
||
SUser.SendNotiPacketMessage(" ", 7);
|
||
SUser.SendNotiPacketMessage("额外获得 :", 7);
|
||
}
|
||
foreach(o, l in UserOpenDgnObj.ItemUprateStkTab) {
|
||
if (o == 999999999 && usergoldupraterate > 0) {
|
||
local countbuf = (l * (usergoldupraterate / 1.0)).tointeger();
|
||
SUser.SendNotiPacketMessage("[金币] +" + (countbuf), 7);
|
||
|
||
Sq_CallFunc(S_Ptr("0x84FF29C"), "int", ["pointer", "int", "int", "int", "int"], Sq_CallFunc(S_Ptr("0x80DA28E"), "pointer", ["pointer"], SUser.C_Object), countbuf, 0, 0, 0);
|
||
// SUser.RechargeMoney(countbuf);
|
||
//刷新背包
|
||
SUser.SendItemSpace(0);
|
||
} else {
|
||
if (userupraterate > 0) {
|
||
local countbuf = (l * (userupraterate)).tointeger();
|
||
if (TW_OpenUprateAddSwitch) { //如果开关打开 就把播报材料里有播报的加上这里的倍数
|
||
if (UserOpenDgnObj.ItemStkCount.rawin(o)) {
|
||
UserOpenDgnObj.ItemStkCount[o] += countbuf;
|
||
}
|
||
}
|
||
local itemnamebuf = TW_UpRatestkTab[o];
|
||
SUser.SendNotiPacketMessage("[" + (itemnamebuf) + "] x" + (countbuf), 7);
|
||
SUser.GiveItem(o, countbuf);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
local sssscount = UserOpenDgnObj.ItemStkCount.len();
|
||
if (TW_EpicCountRewardTab.rawin(UserOpenDgnObj.ItemCount) || sssscount > 0) {
|
||
World.SendNotiPacketMessage(" ", 14);
|
||
World.SendNotiPacketMessage("玩家 : [" + UserName + "] 在 [" + DgnName + "]", 14);
|
||
//累计掉落材料播报
|
||
if (UserOpenDgnObj.ItemStkCount.len() > 0) {
|
||
local bobaocount = 0;
|
||
foreach(i, v in UserOpenDgnObj.ItemStkCount) {
|
||
if (bobaocount == 0)
|
||
World.SendNotiPacketMessage("爆出 : [" + TW_EpicstkTab[i] + "] x" + (v), 14);
|
||
else
|
||
World.SendNotiPacketMessage(" - [" + TW_EpicstkTab[i] + "] x" + (v), 14);
|
||
|
||
bobaocount += 1;
|
||
}
|
||
}
|
||
}
|
||
if (UserOpenDgnObj.ItemCount > 0) {
|
||
local obj = TW_EpicCountRewardTab[UserOpenDgnObj.ItemCount];
|
||
local GiveCount = MathClass.Rand(obj.countMin, obj.countMax);
|
||
if (obj.id == "点券") {
|
||
SUser.RechargeCera(GiveCount);
|
||
World.SendNotiPacketMessage(" - [史诗装备] x" + (UserOpenDgnObj.ItemCount), 14);
|
||
World.SendNotiPacketMessage("奖励 : [" + GiveCount + "点券]", 14);
|
||
} else if (obj.id == "代币") {
|
||
SUser.RechargeCeraPoint(GiveCount);
|
||
World.SendNotiPacketMessage(" - [史诗装备] x" + (UserOpenDgnObj.ItemCount), 14);
|
||
World.SendNotiPacketMessage("奖励 : [" + GiveCount + "代币]", 14);
|
||
} else {
|
||
SUser.GiveItem(obj.id, GiveCount);
|
||
World.SendNotiPacketMessage(" - [史诗装备] x" + (UserOpenDgnObj.ItemCount), 14);
|
||
if (GiveCount == 1)
|
||
World.SendNotiPacketMessage("奖励 : [" + obj.name + "]", 14);
|
||
else
|
||
World.SendNotiPacketMessage("奖励 : [" + obj.name + "] x" + (GiveCount), 14);
|
||
}
|
||
}
|
||
|
||
TW_UserOpenDgnTab.rawdelete(CID);
|
||
}
|
||
}
|
||
|
||
function UserRealObtainItem(SUser, username, cid, item_id, item_count) {
|
||
//如果在副本中
|
||
if (TW_UserOpenDgnTab.rawin(cid)) {
|
||
local OpenDgnTabObj = TW_UserOpenDgnTab[cid];
|
||
|
||
//如果捡到的东西是史诗
|
||
if (TW_EpicTab.rawin(item_id)) {
|
||
local PartyObj = SUser.GetParty();
|
||
if (PartyObj) {
|
||
local Bfobj = PartyObj.GetBattleField();
|
||
local DgnObj = Bfobj.GetDgn();
|
||
if (DgnObj) {
|
||
local DgnIndex = DgnObj.GetId();
|
||
//如果副本编号在 播报副本之内
|
||
if (TW_EpicDgnIndex.rawin(DgnIndex)) {
|
||
TOpenDgnTabObj.ItemCount += 1;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
//如果捡到的东西是播报材料
|
||
else if (TW_EpicstkTab.rawin(item_id)) {
|
||
if (OpenDgnTabObj.ItemStkCount.rawin(item_id))
|
||
OpenDgnTabObj.ItemStkCount[item_id] += item_count;
|
||
else
|
||
OpenDgnTabObj.ItemStkCount[item_id] <- item_count;
|
||
}
|
||
|
||
local DgnName = OpenDgnTabObj.Dgnname.slice(1, OpenDgnTabObj.Dgnname.len() - 1);
|
||
//捡到的东西是多倍材料
|
||
if (TW_UpRateDgnTab.rawin(DgnName)) {
|
||
if (TW_UpRatestkTab.rawin(item_id)) {
|
||
if (OpenDgnTabObj.ItemUprateStkTab.rawin(item_id))
|
||
OpenDgnTabObj.ItemUprateStkTab[item_id] += item_count;
|
||
else
|
||
OpenDgnTabObj.ItemUprateStkTab[item_id] <- item_count;
|
||
}
|
||
}
|
||
|
||
//捡到了当场需要播报奖励的道具
|
||
if (TW_EpicRewardTab.rawin(item_id)) {
|
||
SUser.SendNotiPacketMessage(" ", 14);
|
||
local obj = TW_EpicRewardTab[item_id];
|
||
if (obj.id == "点券") {
|
||
local GiveCount = MathClass.Rand(obj.countMin, obj.countMax);
|
||
SUser.RechargeCera(GiveCount);
|
||
World.SendNotiPacketMessage("玩家 : [" + username + "] 在 [" + DgnName + "]", 14);
|
||
World.SendNotiPacketMessage("爆出 : [" + TW_EpicRewardNameTab[item_id] + "]", 14);
|
||
World.SendNotiPacketMessage("奖励 : [" + GiveCount + "点券]", 14);
|
||
} else if (obj.id == "代币") {
|
||
local GiveCount = MathClass.Rand(obj.countMin, obj.countMax);
|
||
SUser.RechargeCeraPoint(GiveCount);
|
||
World.SendNotiPacketMessage("玩家 : [" + username + "] 在 [" + DgnName + "]", 14);
|
||
World.SendNotiPacketMessage("爆出 : [" + TW_EpicRewardNameTab[item_id] + "]", 14);
|
||
World.SendNotiPacketMessage("奖励 : [" + GiveCount + "代币]", 14);
|
||
} else if (obj.id == null) {
|
||
World.SendNotiPacketMessage("玩家 : [" + username + "] 在 [" + DgnName + "]", 14);
|
||
World.SendNotiPacketMessage("爆出 : [" + TW_EpicRewardNameTab[item_id] + "]", 14);
|
||
} else {
|
||
local GiveCount = MathClass.Rand(obj.countMin, obj.countMax);
|
||
SUser.GiveItem(obj.id, GiveCount);
|
||
World.SendNotiPacketMessage("玩家 : [" + username + "] 在 [" + DgnName + "]", 14);
|
||
World.SendNotiPacketMessage("爆出 : [" + TW_EpicRewardNameTab[item_id] + "]", 14);
|
||
if (GiveCount == 1) {
|
||
World.SendNotiPacketMessage("奖励 : [" + obj.name + "]", 14);
|
||
} else {
|
||
World.SendNotiPacketMessage("奖励 : [" + obj.name + "] x" + GiveCount, 14);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
Cb_History_MoneyUp_Func["TW_MoneyUp"] <- function(SUser, Data) {
|
||
UserRealObtainItem(SUser, SUser.GetCharacName(), SUser.GetCID(), 999999999, Data[15].tointeger());
|
||
}
|
||
Cb_History_ItemUp_Func["TW_ItemUp"] <- function(SUser, Data) {
|
||
UserRealObtainItem(SUser, SUser.GetCharacName(), SUser.GetCID(), Data[15].tointeger(), Data[17].tointeger());
|
||
}
|
||
|
||
//上线公告
|
||
function MiNoti(SUser) {
|
||
//获取背包对象
|
||
local InvenObj = SUser.GetInven();
|
||
//遍历身上的每一件装备
|
||
for (local u = 10; u <= 22; u++) {
|
||
//如果装备存在 并且存在于 加成表中 就给提升率加上对应的值
|
||
local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u);
|
||
if (EquObj && !EquObj.IsEmpty) {
|
||
local EquObjId = EquObj.GetIndex();
|
||
if (TW_MiNoti.rawin(EquObjId)) {
|
||
SUser.SendNotiPacketMessage(format(TW_MiNoti[EquObjId][0], SUser.GetCharacName()), TW_MiNoti[EquObjId][1]);
|
||
World.SendNotiPacketMessage(format(TW_MiNoti[EquObjId][0], SUser.GetCharacName()), TW_MiNoti[EquObjId][1]);
|
||
}
|
||
}
|
||
}
|
||
//遍历身上的每一件装备
|
||
for (local u = 0; u <= 10; u++) {
|
||
//如果装备存在 并且存在于 加成表中 就给提升率加上对应的值
|
||
local EquObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_BODY, u);
|
||
if (EquObj && !EquObj.IsEmpty) {
|
||
local EquObjId = EquObj.GetIndex();
|
||
if (TW_MiNoti.rawin(EquObjId)) {
|
||
SUser.SendNotiPacketMessage(format(TW_MiNoti[EquObjId][0], SUser.GetCharacName()), TW_MiNoti[EquObjId][1]);
|
||
World.SendNotiPacketMessage(format(TW_MiNoti[EquObjId][0], SUser.GetCharacName()), TW_MiNoti[EquObjId][1]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
Cb_reach_game_world_Func["TW_Cb_reach_game_world_Func"] <- function(SUser) {
|
||
MiNoti(SUser);
|
||
}
|
||
|
||
Cb_History_MileageSet_Func["TW_reach_game_world"] <- function(SUser, Data) {
|
||
//第一次上线
|
||
if (SUser.GetCharacLevel() == 1) {
|
||
//设置满级
|
||
SUser.SetCharacLevel(TW_PlayerMaxLevel);
|
||
SUser.SendItemSpace(0);
|
||
SUser.SendItemSpace(1);
|
||
SUser.SendItemSpace(7);
|
||
//设置发送道具
|
||
foreach(_Index, ItemObj in TW_PlayerGiveItemList) {
|
||
SUser.GiveItem(ItemObj[0], ItemObj[1]);
|
||
}
|
||
//设置上线喊话
|
||
// SUser.SendNotiPacketMessage("欢迎新玩家[" + SUser.GetCharacName() + "]进入游戏。", 14);
|
||
World.SendNotiPacketMessage("欢迎新玩家[" + SUser.GetCharacName() + "]进入游戏。", 14);
|
||
local CCargoP = Sq_CallFunc(S_Ptr("0x08151A94"), "pointer", ["pointer"], SUser.C_Object);
|
||
Sq_CallFunc(S_Ptr("0x0850C656"), "int", ["pointer", "int"], CCargoP, 152);
|
||
|
||
local Pack = Packet();
|
||
Pack.Put_Header(0, 66);
|
||
Pack.Put_Short(1);
|
||
Pack.Put_Short(152);
|
||
Pack.Finalize(true);
|
||
SUser.Send(Pack);
|
||
Pack.Delete();
|
||
|
||
Sq_MysqlExecNoRet("INSERT INTO taiwan_cain.account_cargo (m_id,money,capacity)VALUES(" + SUser.GetUID() + ",0,56);");
|
||
|
||
|
||
// SUser.GiveItem(3299, 6);
|
||
Sq_CallFunc(S_Ptr("0x84FF29C"), "int", ["pointer", "int", "int", "int", "int"], Sq_CallFunc(S_Ptr("0x80DA28E"), "pointer", ["pointer"], SUser.C_Object), 100, 0, 0, 0);
|
||
Sq_CallFunc(S_Ptr("0x0828AD72"), "void", ["pointer"], SUser.C_Object);
|
||
|
||
SUser.ClearQuest_Gm(674);
|
||
SUser.ClearQuest_Gm(649);
|
||
|
||
SUser.ClearQuest_Gm(675);
|
||
SUser.ClearQuest_Gm(650);
|
||
//升级
|
||
// Sq_CallFunc(S_Ptr("0x0828B0B2"), "void", ["pointer"], SUser.C_Object);
|
||
// Sq_CallFunc(S_Ptr("0x0828B0B2"), "void", ["pointer"], SUser.C_Object);
|
||
// Sq_CallFunc(S_Ptr("0x0828B0B2"), "void", ["pointer"], SUser.C_Object);
|
||
// Sq_CallFunc(S_Ptr("0x0828B0B2"), "void", ["pointer"], SUser.C_Object);
|
||
// Sq_CallFunc(S_Ptr("0x0828B0B2"), "void", ["pointer"], SUser.C_Object);
|
||
// Sq_CallFunc(S_Ptr("0x0828B0B2"), "void", ["pointer"], SUser.C_Object);
|
||
}
|
||
}
|
||
|
||
if (!(getroottable().rawin("TWPlayerOnlineTab"))) getroottable().TWPlayerOnlineTab <- {};
|
||
if (!(getroottable().rawin("TWPlayerOnlineCheckTab"))) getroottable().TWPlayerOnlineCheckTab <- {};
|
||
if (!(getroottable().rawin("TWTime_RewardSend"))) getroottable().TWTime_RewardSend <- {};
|
||
|
||
|
||
Cb_History_IPUp_Func["TW_Cb_History_IPUp_Func"] <- function(UID, CID, Data) {
|
||
getroottable().TWPlayerOnlineTab[UID] <- true;
|
||
if (!(getroottable().TWPlayerOnlineCheckTab.rawin(UID))) getroottable().TWPlayerOnlineCheckTab[UID] <- 0;
|
||
}
|
||
Cb_return_select_character_Func["TW_Cb_History_IPDown_Func"] <- function(SUser) {
|
||
if (getroottable().TWPlayerOnlineTab.rawin(SUser.GetUID()))
|
||
getroottable().TWPlayerOnlineTab.rawdelete(SUser.GetUID());
|
||
if (getroottable().TWPlayerOnlineCheckTab.rawin(SUser.GetUID()))
|
||
getroottable().TWPlayerOnlineCheckTab.rawdelete(SUser.GetUID());
|
||
}
|
||
|
||
|
||
Cb_timer_dispatch_Func["TW_Cb_timer_dispatch_Func"] <- function() {
|
||
local CurTime = time();
|
||
|
||
foreach(UID, Flag in getroottable().TWPlayerOnlineTab) {
|
||
local SUser = World.GetUserByUid(UID);
|
||
if (SUser) {
|
||
//假人 直接移除
|
||
local UserIpAddress = SUser.GetIpAddress();
|
||
if (UserIpAddress == TW_jiaren_IP) {
|
||
if (getroottable().TWPlayerOnlineTab.rawin(UID))
|
||
getroottable().TWPlayerOnlineTab.rawdelete(UID);
|
||
if (getroottable().TWPlayerOnlineCheckTab.rawin(UID))
|
||
getroottable().TWPlayerOnlineCheckTab.rawdelete(UID);
|
||
}
|
||
|
||
if (SUser.GetState() >= 3) {
|
||
local LoginTime = SUser.GetCurCharacLoginTick();
|
||
local OnlineTime = CurTime - LoginTime;
|
||
|
||
if ((OnlineTime - getroottable().TWPlayerOnlineCheckTab[UID]) >= TW_OnlineRT) {
|
||
getroottable().TWPlayerOnlineCheckTab[UID] += TW_OnlineRT;
|
||
local mitems = {};
|
||
local Notitab = [];
|
||
|
||
foreach(i, v in TW_Online_Event_Reward) {
|
||
local SendBool = MathClass.Rand(1, 100);
|
||
if (SendBool <= v.rate) {
|
||
if (v.id == "点券") {
|
||
local Count = MathClass.Rand(v.mincount, v.maxcount);
|
||
SUser.RechargeCera(Count);
|
||
Notitab.append({
|
||
name = v.name,
|
||
scount = Count
|
||
});
|
||
} else if (v.id == "代币券") {
|
||
local Count = MathClass.Rand(v.mincount, v.maxcount);
|
||
SUser.RechargeCeraPoint(Count);
|
||
Notitab.append({
|
||
name = v.name,
|
||
scount = Count
|
||
});
|
||
} else {
|
||
local Count = MathClass.Rand(v.mincount, v.maxcount);
|
||
local Ret = SUser.GiveItem(v.id, Count);
|
||
if (!Ret) {
|
||
mitems[v.id] <- (Count);
|
||
}
|
||
Notitab.append({
|
||
name = v.name,
|
||
scount = Count
|
||
});
|
||
}
|
||
}
|
||
}
|
||
if (mitems.len() > 0) {
|
||
SUser.SendMail(mitems, {
|
||
Title = TW_STR_00001,
|
||
Text = TW_STR_00002
|
||
})
|
||
}
|
||
|
||
SUser.SendNotiPacketMessage(" ", 6);
|
||
SUser.SendNotiPacketMessage(TW_STR_00019, 6);
|
||
SUser.SendNotiPacketMessage(" ", 6);
|
||
foreach(w in Notitab) {
|
||
if (w.name == "点券" || w.name == "代币券") {
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00020, w.name, w.scount), 6);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00021, w.name, w.scount), 6);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
local DateObj = date();
|
||
local HourminTime = DateObj.hour + ":" + DateObj.min;
|
||
if (DateObj.min.tostring() == "00") print(HourminTime);
|
||
if (TW_Time_Reward.rawin(HourminTime) && !(TWTime_RewardSend.rawin(HourminTime))) {
|
||
TWTime_RewardSend.rawset(HourminTime, true);
|
||
foreach(UID, Flag in getroottable().TWPlayerOnlineTab) {
|
||
local SUser = World.GetUserByUid(UID);
|
||
if (SUser) {
|
||
//假人 直接移除
|
||
local UserIpAddress = SUser.GetIpAddress();
|
||
if (UserIpAddress == TW_jiaren_IP) {
|
||
if (getroottable().TWPlayerOnlineTab.rawin(UID))
|
||
getroottable().TWPlayerOnlineTab.rawdelete(UID);
|
||
if (getroottable().TWPlayerOnlineCheckTab.rawin(UID))
|
||
getroottable().TWPlayerOnlineCheckTab.rawdelete(UID);
|
||
}
|
||
|
||
if (SUser.GetState() >= 3) {
|
||
|
||
local mitems = {};
|
||
local Notitab = [];
|
||
|
||
foreach(i, v in TW_Time_Reward[HourminTime]) {
|
||
local SendBool = MathClass.Rand(1, 100);
|
||
if (SendBool <= v.rate) {
|
||
if (v.id == "点券") {
|
||
local Count = MathClass.Rand(v.mincount, v.maxcount);
|
||
SUser.RechargeCera(Count);
|
||
Notitab.append({
|
||
name = v.name,
|
||
scount = Count
|
||
});
|
||
} else if (v.id == "代币券") {
|
||
local Count = MathClass.Rand(v.mincount, v.maxcount);
|
||
SUser.RechargeCeraPoint(Count);
|
||
Notitab.append({
|
||
name = v.name,
|
||
scount = Count
|
||
});
|
||
} else {
|
||
local Count = MathClass.Rand(v.mincount, v.maxcount);
|
||
local Ret = SUser.GiveItem(v.id, Count);
|
||
if (!Ret) {
|
||
mitems[v.id] <- (Count);
|
||
}
|
||
Notitab.append({
|
||
name = v.name,
|
||
scount = Count
|
||
});
|
||
}
|
||
}
|
||
}
|
||
if (mitems.len() > 0) {
|
||
SUser.SendMail(mitems, {
|
||
Title = TW_STR_00001,
|
||
Text = TW_STR_00002
|
||
})
|
||
}
|
||
|
||
SUser.SendNotiPacketMessage(" ", 6);
|
||
SUser.SendNotiPacketMessage(TW_STR_00022, 6);
|
||
SUser.SendNotiPacketMessage(" ", 6);
|
||
foreach(w in Notitab) {
|
||
if (w.name == "点券" || w.name == "代币券") {
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00020, w.name, w.scount), 6);
|
||
} else {
|
||
SUser.SendNotiPacketMessage(format(TW_STR_00021, w.name, w.scount), 6);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (HourminTime == "00:01") {
|
||
TWTime_RewardSend.HourminTime = {};
|
||
}
|
||
}
|
||
|
||
function Cb_GameWorld_move_position(C_User, a3, a4, a5, a6) {
|
||
return;
|
||
}
|
||
|
||
TWTime_RewardSend <- {};
|
||
|
||
|
||
function PrintTag() {
|
||
print(InitSuccessTag);
|
||
|
||
Sq_MysqlExecNoRet("ALTER TABLE taiwan_cain_2nd.inventory MODIFY COLUMN inventory_capacity INT DEFAULT 16;");
|
||
Sq_MysqlExecNoRet("ALTER TABLE taiwan_cain.account_cargo MODIFY COLUMN capacity INT DEFAULT 56;")
|
||
|
||
}
|
||
|
||
function Sq_SendPackToGateway(abs) {
|
||
|
||
}
|
||
|
||
function Cb_GameWorld_move_position(C_User, a3, a4, a5, a6) {
|
||
return;
|
||
}
|
||
|
||
|
||
Gm_InputFunc_Handle.FI <- function(SUser, CmdString) {
|
||
// Sq_CallFunc(S_Ptr("0x84FF29C"), "int", ["pointer", "int", "int", "int", "int"], Sq_CallFunc(S_Ptr("0x80DA28E"), "pointer", ["pointer"], SUser.C_Object), 50000000, 0, 0, 0);
|
||
Sq_CallFunc(S_Ptr("0x0828B0B2"), "void", ["pointer"], SUser.C_Object);
|
||
} |