// Token: 0x06000DBC RID: 3516 RVA: 0x00062418 File Offset: 0x00060618 public void Deserialize(ref ZPackage pkg) { this.m_damage.m_damage = pkg.ReadSingle(); this.m_damage.m_blunt = pkg.ReadSingle(); this.m_damage.m_slash = pkg.ReadSingle(); this.m_damage.m_pierce = pkg.ReadSingle(); this.m_damage.m_chop = pkg.ReadSingle(); this.m_damage.m_pickaxe = pkg.ReadSingle(); this.m_damage.m_fire = pkg.ReadSingle(); this.m_damage.m_frost = pkg.ReadSingle(); this.m_damage.m_lightning = pkg.ReadSingle(); this.m_damage.m_poison = pkg.ReadSingle(); this.m_damage.m_spirit = pkg.ReadSingle(); this.m_toolTier = pkg.ReadInt(); this.m_pushForce = pkg.ReadSingle(); this.m_backstabBonus = pkg.ReadSingle(); this.m_staggerMultiplier = pkg.ReadSingle(); this.m_dodgeable = pkg.ReadBool(); this.m_blockable = pkg.ReadBool(); this.m_point = pkg.ReadVector3(); this.m_dir = pkg.ReadVector3(); this.m_statusEffect = pkg.ReadString(); this.m_attacker = pkg.ReadZDOID(); this.m_skill = (Skills.SkillType)pkg.ReadInt(); }
// Token: 0x06001161 RID: 4449 RVA: 0x00078784 File Offset: 0x00076984 public void Deserialize(ZPackage pkg) { this.m_msgID = pkg.ReadLong(); this.m_senderPeerID = pkg.ReadLong(); this.m_targetPeerID = pkg.ReadLong(); this.m_targetZDO = pkg.ReadZDOID(); this.m_methodHash = pkg.ReadInt(); this.m_parameters = pkg.ReadPackage(); }
// Token: 0x060007CF RID: 1999 RVA: 0x0003D610 File Offset: 0x0003B810 private void RPC_DestroyZDO(long sender, ZPackage pkg) { int num = pkg.ReadInt(); for (int i = 0; i < num; i++) { ZDOID uid = pkg.ReadZDOID(); this.HandleDestroyedZDO(uid); } }
public static ZDOIDSet From(ZPackage package) { ZDOIDSet result = new ZDOIDSet(); int size = package.ReadInt(); for (int i = 0; i < size; i++) { result.Add(package.ReadZDOID()); } return(result); }
public static void ProcessZDOs(long sender, ZPackage pkg) { //Def_handy_portals.logger.LogWarning("ProcessZDOs pkg.size:" + pkg.Size()); if (pkg != null && pkg.Size() > 0) { int count = pkg.ReadInt(); //Def_handy_portals.logger.LogWarning("zdos count: " + count); while (count > 0) { ZDOID zdoid = pkg.ReadZDOID(); //Def_handy_portals.logger.LogWarning("zdoid: " + zdoid + "prefab: "); count--; } } }
// Token: 0x06000918 RID: 2328 RVA: 0x0004377C File Offset: 0x0004197C public static void Deserialize(ParameterInfo[] paramInfo, ZPackage pkg, ref List <object> parameters) { for (int i = 1; i < paramInfo.Length; i++) { ParameterInfo parameterInfo = paramInfo[i]; if (parameterInfo.ParameterType == typeof(int)) { parameters.Add(pkg.ReadInt()); } else if (parameterInfo.ParameterType == typeof(uint)) { parameters.Add(pkg.ReadUInt()); } else if (parameterInfo.ParameterType == typeof(long)) { parameters.Add(pkg.ReadLong()); } else if (parameterInfo.ParameterType == typeof(float)) { parameters.Add(pkg.ReadSingle()); } else if (parameterInfo.ParameterType == typeof(double)) { parameters.Add(pkg.ReadDouble()); } else if (parameterInfo.ParameterType == typeof(bool)) { parameters.Add(pkg.ReadBool()); } else if (parameterInfo.ParameterType == typeof(string)) { parameters.Add(pkg.ReadString()); } else if (parameterInfo.ParameterType == typeof(ZPackage)) { parameters.Add(pkg.ReadPackage()); } else if (parameterInfo.ParameterType == typeof(List <string>)) { int num = pkg.ReadInt(); List <string> list = new List <string>(num); for (int j = 0; j < num; j++) { list.Add(pkg.ReadString()); } parameters.Add(list); } else if (parameterInfo.ParameterType == typeof(Vector3)) { Vector3 vector = new Vector3(pkg.ReadSingle(), pkg.ReadSingle(), pkg.ReadSingle()); parameters.Add(vector); } else if (parameterInfo.ParameterType == typeof(Quaternion)) { Quaternion quaternion = new Quaternion(pkg.ReadSingle(), pkg.ReadSingle(), pkg.ReadSingle(), pkg.ReadSingle()); parameters.Add(quaternion); } else if (parameterInfo.ParameterType == typeof(ZDOID)) { parameters.Add(pkg.ReadZDOID()); } else if (parameterInfo.ParameterType == typeof(HitData)) { HitData hitData = new HitData(); hitData.Deserialize(ref pkg); parameters.Add(hitData); } } }
// Token: 0x060007D3 RID: 2003 RVA: 0x0003D98C File Offset: 0x0003BB8C private void RPC_ZDOData(ZRpc rpc, ZPackage pkg) { ZDOMan.ZDOPeer zdopeer = this.FindPeer(rpc); if (zdopeer == null) { ZLog.Log("ZDO data from unkown host, ignoring"); return; } float time = Time.time; int num = 0; ZPackage pkg2 = new ZPackage(); int num2 = pkg.ReadInt(); for (int i = 0; i < num2; i++) { ZDOID id = pkg.ReadZDOID(); ZDO zdo = this.GetZDO(id); if (zdo != null) { zdo.InvalidateSector(); } } for (;;) { ZDOID zdoid = pkg.ReadZDOID(); if (zdoid.IsNone()) { break; } num++; uint num3 = pkg.ReadUInt(); uint num4 = pkg.ReadUInt(); long owner = pkg.ReadLong(); Vector3 vector = pkg.ReadVector3(); pkg.ReadPackage(ref pkg2); ZDO zdo2 = this.GetZDO(zdoid); bool flag = false; if (zdo2 != null) { if (num4 <= zdo2.m_dataRevision) { if (num3 > zdo2.m_ownerRevision) { zdo2.m_owner = owner; zdo2.m_ownerRevision = num3; zdopeer.m_zdos[zdoid] = new ZDOMan.ZDOPeer.PeerZDOInfo(num4, num3, time); continue; } continue; } } else { zdo2 = this.CreateNewZDO(zdoid, vector); flag = true; } zdo2.m_ownerRevision = num3; zdo2.m_dataRevision = num4; zdo2.m_owner = owner; zdo2.InternalSetPosition(vector); zdopeer.m_zdos[zdoid] = new ZDOMan.ZDOPeer.PeerZDOInfo(zdo2.m_dataRevision, zdo2.m_ownerRevision, time); zdo2.Deserialize(pkg2); if (ZNet.instance.IsServer() && flag && this.m_deadZDOs.ContainsKey(zdoid)) { zdo2.SetOwner(this.m_myid); this.DestroyZDO(zdo2); } } this.m_zdosRecv += num; }
// Token: 0x060001C5 RID: 453 RVA: 0x0000F2F0 File Offset: 0x0000D4F0 public static Player Load(ZPackage pkg) { var player = new Player(); int num = pkg.ReadInt(); if (num >= 7) { player.MaxHealth = pkg.ReadSingle(); } player.Health = pkg.ReadSingle(); if (num >= 10) { player.MaxStamina = pkg.ReadSingle(); } if (num >= 8) { player.FirstSpawn = pkg.ReadBool(); } if (num >= 20) { player.TimeSinceDeath = pkg.ReadSingle(); } if (num >= 23) { player.GuardianPower = pkg.ReadString(); } if (num >= 24) { player.GuardianPowerCooldown = pkg.ReadSingle(); } if (num == 2) { pkg.ReadZDOID(); } player.Inventory = InventoryReaderWriter.Load(pkg); int num3 = pkg.ReadInt(); for (int i = 0; i < num3; i++) { string item = pkg.ReadString(); player.m_knownRecipes.Add(item); } if (num < 15) { int num4 = pkg.ReadInt(); for (int j = 0; j < num4; j++) { pkg.ReadString(); } } else { int num5 = pkg.ReadInt(); for (int k = 0; k < num5; k++) { string key = pkg.ReadString(); int value = pkg.ReadInt(); player.m_knownStations.Add(key, value); } } int num6 = pkg.ReadInt(); for (int l = 0; l < num6; l++) { string item2 = pkg.ReadString(); player.m_knownMaterial.Add(item2); } if (num < 19 || num >= 21) { int num7 = pkg.ReadInt(); for (int m = 0; m < num7; m++) { string item3 = pkg.ReadString(); player.m_shownTutorials.Add(item3); } } if (num >= 6) { int num8 = pkg.ReadInt(); for (int n = 0; n < num8; n++) { string item4 = pkg.ReadString(); player.m_uniques.Add(item4); } } if (num >= 9) { int num9 = pkg.ReadInt(); for (int num10 = 0; num10 < num9; num10++) { string item5 = pkg.ReadString(); player.m_trophies.Add(item5); } } if (num >= 18) { int num11 = pkg.ReadInt(); for (int num12 = 0; num12 < num11; num12++) { Biome item6 = (Biome)pkg.ReadInt(); player.m_knownBiome.Add(item6); } } if (num >= 22) { int num13 = pkg.ReadInt(); for (int num14 = 0; num14 < num13; num14++) { string key2 = pkg.ReadString(); string value2 = pkg.ReadString(); player.m_knownTexts.Add(key2, value2); } } if (num >= 4) { string beard = pkg.ReadString(); string hair = pkg.ReadString(); player.Beard = beard; player.Hair = hair; } if (num >= 5) { Vector3 skinColor = pkg.ReadVector3(); Vector3 hairColor = pkg.ReadVector3(); player.SkinColor = skinColor; player.HairColor = hairColor; } if (num >= 11) { int playerModel = pkg.ReadInt(); player.PlayerModel = playerModel; } if (num >= 12) { player.m_foods.Clear(); int num15 = pkg.ReadInt(); for (int num16 = 0; num16 < num15; num16++) { if (num >= 14) { var food = new Food(); food.m_name = pkg.ReadString(); food.m_health = pkg.ReadSingle(); if (num >= 16) { food.m_stamina = pkg.ReadSingle(); } player.m_foods.Add(food); } else { pkg.ReadString(); pkg.ReadSingle(); pkg.ReadSingle(); pkg.ReadSingle(); pkg.ReadSingle(); pkg.ReadSingle(); pkg.ReadSingle(); if (num >= 13) { pkg.ReadSingle(); } } } } if (num >= 17) { player.Skills = SkillsReaderWriter.Load(pkg); } return(player); }
//CALLED ON SERVER, Should contain ZDOID and Inventory public static void RPC_CharacterIDX(ZRpc rpc, ZPackage pkg) { ZDOID characterID = pkg.ReadZDOID(); ZNetPeer peer = (ZNetPeer)_GetPeerMethod.Invoke(ZNet.instance, new object[] { rpc }); if (peer != null) { peer.m_characterID = characterID; if (Configs.ShowDebugMessages.Value) { ZLog.Log($"Got character ZDOID with inventory from {peer.m_playerName} : {characterID}!"); } } ZPackage inventoryPackage = pkg.ReadPackage(); String characterName = inventoryPackage.ReadString(); int itemsCount = inventoryPackage.ReadInt(); String steamId = rpc.GetSocket().GetEndPointString(); if (Configs.ShowDebugMessages.Value) { Instance.Logger.LogInfo($"Getting player {characterName}'s ({steamId}) inventory..."); } List <Server_ItemData> playerItems = new List <Server_ItemData>(); for (int i = 0; i < itemsCount; i++) { Server_ItemData data = new Server_ItemData { Name = inventoryPackage.ReadString(), Stack = inventoryPackage.ReadInt(), Quality = inventoryPackage.ReadInt(), Variant = inventoryPackage.ReadInt() }; playerItems.Add(data); } if (Configs.ShowDebugMessages.Value) { Instance.Logger.LogInfo($"Found {playerItems.Count} items in {characterName}'s inventory."); } String dbId = $"{steamId}_{characterName}"; var dbPlayer = Instance.DB.GetPlayerById(dbId); if (dbPlayer == null) { if (Configs.ShowDebugMessages.Value) { Instance.Logger.LogInfo($"{characterName} is a new character!"); } DBClasses.DBPlayer[] characters = Instance.DB.GetPlayersBySteamId(steamId); if (characters.Length >= Configs.MaxCharactersPerPlayer.Value) { rpc.Invoke("Error", new object[] { (int)ZNet.ConnectionStatus.ErrorVersion }); return; } dbPlayer = new DBClasses.DBPlayer() { DBPlayerId = dbId, SteamId = steamId, CharacterName = characterName, Items = new List <DBClasses.DBItem>() }; foreach (var item in playerItems) { dbPlayer.Items.Add(new DBClasses.DBItem() { ItemName = item.Name, PlayerId = dbPlayer.DBPlayerId, StackCount = item.Stack, Quality = item.Quality, Variant = item.Variant }); } Instance.DB.InsertPlayer(dbPlayer); } else { bool isSame = true; if (dbPlayer.Items.Count != playerItems.Count) { isSame = false; } else { for (int i = 0; i < dbPlayer.Items.Count; i++) { if (dbPlayer.Items[i].ItemName != playerItems[i].Name || dbPlayer.Items[i].StackCount != playerItems[i].Stack || dbPlayer.Items[i].Quality != playerItems[i].Quality || dbPlayer.Items[i].Variant != playerItems[i].Variant) { isSame = false; break; } } } if (isSame) { if (Configs.ShowDebugMessages.Value) { Instance.Logger.LogInfo($"{characterName} is still the same"); } dbPlayer.LastLoggedIn = DateTime.Now; Instance.DB.UpdatePlayer(dbPlayer); } else { if (Configs.ShowDebugMessages.Value) { Instance.Logger.LogWarning($"{characterName} is NOT the same!"); } rpc.Invoke("Error", new object[] { (int)ZNet.ConnectionStatus.ErrorVersion }); } } }