| 
									
										
										
										
											2025-05-27 21:24:22 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 文件名:PackControl.nut | 
					
						
							|  |  |  | 路径:Base/PackControl/PackControl.nut | 
					
						
							|  |  |  | 创建日期:2024-08-06	22:13 | 
					
						
							|  |  |  | 文件用途: | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | Pack_Control <- {} | 
					
						
							|  |  |  | Pack_DPS_Control <- {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function Register_DPS_Pack(Id, Func) { | 
					
						
							|  |  |  |     Pack_DPS_Control.rawset(Id, Func); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function Sq_Pack_Control(Chunk) { | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  |         local Pack_Json = Json.Decode(Chunk); | 
					
						
							|  |  |  |         if (Pack_Json.op == 2147483646) { | 
					
						
							|  |  |  |             if (Pack_DPS_Control.rawin(Pack_Json.dps_id)) { | 
					
						
							|  |  |  |                 local Jso = Json.Decode(Chunk); | 
					
						
							|  |  |  |                 Jso.rawdelete("op"); | 
					
						
							|  |  |  |                 Pack_DPS_Control[Pack_Json.dps_id](Jso); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             if (Pack_Control.rawin(Pack_Json.op)) { | 
					
						
							|  |  |  |                 try { | 
					
						
							|  |  |  |                     Pack_Control[Pack_Json.op](Chunk); | 
					
						
							|  |  |  |                 } catch (exception) { | 
					
						
							|  |  |  |                     print("error pack: " + Pack_Json.op); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } catch (exception) { | 
					
						
							|  |  |  |         print("error packmsg: " + Pack_Json.op); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function Sq_Pack_ControlLocal(Chunk) { | 
					
						
							|  |  |  |     local Pack_Json = Json.Decode(Chunk); | 
					
						
							|  |  |  |     if (Pack_Json.op == 2147483646) { | 
					
						
							|  |  |  |         if (Pack_DPS_Control.rawin(Pack_Json.dps_id)) { | 
					
						
							|  |  |  |             local Jso = Json.Decode(Chunk); | 
					
						
							|  |  |  |             Jso.rawdelete("op"); | 
					
						
							|  |  |  |             Pack_DPS_Control[Pack_Json.dps_id](Jso); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         if (Pack_Control.rawin(Pack_Json.op)) { | 
					
						
							|  |  |  |             Pack_Control[Pack_Json.op](Chunk); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-05 22:29:11 +08:00
										 |  |  | //字节流包 | 
					
						
							|  |  |  | function Sq_BlobPack_Control(Size,Pointer) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     local Pack = Packet(); | 
					
						
							|  |  |  |     Pack.Load(Pointer,Size); | 
					
						
							|  |  |  |     // print(Pack.GetInt()); | 
					
						
							|  |  |  |     // print(Pack.GetInt()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-27 21:24:22 +08:00
										 |  |  | function SendPackToDP_S(Id, T) { | 
					
						
							|  |  |  |     T.op <- 2147483646; | 
					
						
							|  |  |  |     T.dps_id <- Id; | 
					
						
							|  |  |  |     Rindro_BaseToolClass.SendPackEx(T); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //进入副本回调 | 
					
						
							|  |  |  | function LenheartGotoDgnCallBack(Chunk) { | 
					
						
							|  |  |  |     local Jso = Json.Decode(Chunk); | 
					
						
							|  |  |  |     local DgnId = Jso.map.id; | 
					
						
							|  |  |  |     local DgnRate = Jso.map.ra; | 
					
						
							|  |  |  |     L_sq_GoDungeon(DgnId); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | Pack_Control.rawset(2024041602, LenheartGotoDgnCallBack); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //进入副本增加属性 | 
					
						
							|  |  |  | function LenheartAdditionalAttributes(obj) { | 
					
						
							| 
									
										
										
										
											2025-07-05 22:29:11 +08:00
										 |  |  |     obj = sq_ObjectToSQRCharacter(obj); | 
					
						
							| 
									
										
										
										
											2025-05-27 21:24:22 +08:00
										 |  |  |     //在副本中 | 
					
						
							|  |  |  |     if (sq_GetCurrentModuleType() == 3) { | 
					
						
							|  |  |  |         if (!CNSquirrelAppendage.sq_IsAppendAppendage(obj, "appendage/lenheartap.nut")) { | 
					
						
							|  |  |  |             if ("LenheartAttributesTable" in getroottable()) { | 
					
						
							|  |  |  |                 local Abarr = {}; | 
					
						
							|  |  |  |                 foreach(AtObj in getroottable()["LenheartAttributesTable"]) { | 
					
						
							|  |  |  |                     foreach(Apos, At in AtObj) { | 
					
						
							| 
									
										
										
										
											2025-07-05 22:29:11 +08:00
										 |  |  |                         if (!Abarr.rawin(Apos)) Abarr[Apos] <- At; | 
					
						
							|  |  |  |                         else Abarr[Apos] += At; | 
					
						
							| 
									
										
										
										
											2025-05-27 21:24:22 +08:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 local appendage = CNSquirrelAppendage.sq_AppendAppendage(obj, obj, -1, false, "appendage/lenheartap.nut", true); | 
					
						
							| 
									
										
										
										
											2025-07-05 22:29:11 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-27 21:24:22 +08:00
										 |  |  |                 CNSquirrelAppendage.sq_Append(appendage, obj, obj); | 
					
						
							|  |  |  |                 local change_appendage = appendage.sq_getChangeStatus("Yosin_LenheartDgnBuff"); | 
					
						
							|  |  |  |                 if (!change_appendage) { | 
					
						
							|  |  |  |                     change_appendage = appendage.sq_AddChangeStatusAppendageID(obj, obj, 0, | 
					
						
							|  |  |  |                         CHANGE_STATUS_TYPE_COOLTIME_DECLINE, | 
					
						
							|  |  |  |                         false, 0, 115514); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 if (change_appendage) { | 
					
						
							|  |  |  |                     change_appendage.clearParameter(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     foreach(Key, Value in Abarr) { | 
					
						
							|  |  |  |                         if (Key == 0) change_appendage.addParameter(13, false, Value.tofloat()); //HP | 
					
						
							|  |  |  |                         else if (Key == 1) change_appendage.addParameter(48, false, Value.tofloat()); //MP | 
					
						
							|  |  |  |                         else if (Key == "strength") change_appendage.addParameter(0, false, Value.tofloat()); //力量 | 
					
						
							|  |  |  |                         else if (Key == "intelligence") change_appendage.addParameter(1, false, Value.tofloat()); //智力 | 
					
						
							|  |  |  |                         else if (Key == "vitality") change_appendage.addParameter(2, false, Value.tofloat()); //体力 | 
					
						
							|  |  |  |                         else if (Key == "spirit") change_appendage.addParameter(3, false, Value.tofloat()); //精神 | 
					
						
							|  |  |  |                         else if (Key == "physicalAttack") change_appendage.addParameter(4, false, Value.tofloat()); //物攻 | 
					
						
							|  |  |  |                         else if (Key == "magicAttack") change_appendage.addParameter(31, false, Value.tofloat()); //魔攻 | 
					
						
							|  |  |  |                         else if (Key == "independentAttack") { | 
					
						
							|  |  |  |                             change_appendage.addParameter(53, false, Value.tofloat()); //独立 | 
					
						
							|  |  |  |                             change_appendage.addParameter(54, false, Value.tofloat()); //独立 | 
					
						
							|  |  |  |                         } else if (Key == "physicalDefense") change_appendage.addParameter(5, false, Value.tofloat()); //物理防御 | 
					
						
							|  |  |  |                         else if (Key == "magicDefense") change_appendage.addParameter(32, false, Value.tofloat()); //魔法防御 | 
					
						
							|  |  |  |                         else if (Key == "physicalCritical") change_appendage.addParameter(15, false, Value.tofloat() / 10.0); //物理暴击 | 
					
						
							|  |  |  |                         else if (Key == "magicCritical") change_appendage.addParameter(16, false, Value.tofloat() / 10.0); //魔法暴击 | 
					
						
							|  |  |  |                         else if (Key == "attackSpeed") change_appendage.addParameter(10, false, Value.tofloat()); //攻速 | 
					
						
							|  |  |  |                         else if (Key == "releaseSpeed") change_appendage.addParameter(12, false, Value.tofloat()); //释放 | 
					
						
							|  |  |  |                         else if (Key == "moveSpeed") change_appendage.addParameter(11, false, Value.tofloat()); //移速 | 
					
						
							|  |  |  |                         else if (Key == "resistance") change_appendage.addParameter(39, false, Value.tofloat()); //抗磨 | 
					
						
							|  |  |  |                         else if (Key == "hitRate") change_appendage.addParameter(33, false, Value.tofloat()); //命中 | 
					
						
							|  |  |  |                         else if (Key == "avoidance") change_appendage.addParameter(27, false, Value.tofloat()); //闪避 | 
					
						
							|  |  |  |                         else if (Key == "hpRecovery") change_appendage.addParameter(14, false, Value.tofloat()); //HP恢复 | 
					
						
							|  |  |  |                         else if (Key == "mpRecovery") change_appendage.addParameter(29, false, Value.tofloat()); //MP恢复 | 
					
						
							|  |  |  |                         else if (Key == "stun") change_appendage.addParameter(41, false, Value.tofloat()); //僵直 | 
					
						
							|  |  |  |                         else if (Key == "hardStun") change_appendage.addParameter(34, false, Value.tofloat()); //硬直 | 
					
						
							|  |  |  |                         else if (Key == "fire") change_appendage.addParameter(42, false, Value.tofloat()); //火强 | 
					
						
							|  |  |  |                         else if (Key == "fireResistance") change_appendage.addParameter(20, false, Value.tofloat()); //火抗 | 
					
						
							|  |  |  |                         else if (Key == "water") change_appendage.addParameter(43, false, Value.tofloat()); //冰强 | 
					
						
							|  |  |  |                         else if (Key == "waterResistance") change_appendage.addParameter(21, false, Value.tofloat()); //冰抗 | 
					
						
							|  |  |  |                         else if (Key == "light") change_appendage.addParameter(45, false, Value.tofloat()); //光强 | 
					
						
							|  |  |  |                         else if (Key == "lightResistance") change_appendage.addParameter(23, false, Value.tofloat()); //光抗 | 
					
						
							|  |  |  |                         else if (Key == "dark") change_appendage.addParameter(44, false, Value.tofloat()); //暗强 | 
					
						
							|  |  |  |                         else if (Key == "darkResistance") change_appendage.addParameter(22, false, Value.tofloat()); //暗抗 | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (getroottable().rawin("LenheartFuncTab")) { | 
					
						
							|  |  |  |     getroottable()["LenheartFuncTab"].rawset("LenheartAdditionalAttributesFunc", LenheartAdditionalAttributes); | 
					
						
							|  |  |  | } else { | 
					
						
							|  |  |  |     local T = {}; | 
					
						
							|  |  |  |     T.rawset("LenheartAdditionalAttributesFunc", LenheartAdditionalAttributes); | 
					
						
							|  |  |  |     getroottable().rawset("LenheartFuncTab", T); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //进入副本增加属性 | 
					
						
							|  |  |  | function LenheartAdditionalCallBack(Chunk) { | 
					
						
							|  |  |  |     local Jso = Json.Decode(Chunk); | 
					
						
							|  |  |  |     if ("LenheartAttributesTable" in getroottable()) { | 
					
						
							|  |  |  |         local T = getroottable()["LenheartAttributesTable"]; | 
					
						
							|  |  |  |         T.rawset("LenheartCollectBoxAb", Jso.Attribute); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         local T = {}; | 
					
						
							|  |  |  |         T.rawset("LenheartCollectBoxAb", Jso.Attribute); | 
					
						
							|  |  |  |         getroottable().rawset("LenheartAttributesTable", T); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-07-05 22:29:11 +08:00
										 |  |  | Pack_Control.rawset(20069016, LenheartAdditionalCallBack); |