public Player(GameClient client, Universe universe, Toon bnetToon) { this.Client = client; this.Universe = universe; this.Hero = new Hero(client, universe, bnetToon); }
public void Reveal(Hero toon) { if (toon.RevealedActors.Contains(this)) return; //already revealed toon.RevealedActors.Add(this); var msg = new ACDEnterKnownMessage { Field0 = DynamicId, Field1 = SnoId, Field2 = Field2, Field3 = Field3, Field4 = new WorldLocationMessageData { Field0 = Scale, Field1 = new PRTransform { Field0 = new Quaternion { Amount = RotationAmount, Axis = RotationAxis, }, ReferencePoint = Position, }, Field2 = WorldId, }, Field5 = InventoryLocationData, Field6 = GBHandle, Field7 = Field7, Field8 = Field8, Field9 = Field9, Field10 = Field10, }; toon.InGameClient.SendMessage(msg); toon.InGameClient.FlushOutgoingBuffer(); }
public Inventory(Hero owner) { this._owner = owner; this._backpack = new int[6, 10]; this._equipment = new int[16]; this._goldObjectId = 0; }
public void Destroy(Hero hero) { if (!hero.RevealedActors.Contains(this)) return; //not revealed yet hero.InGameClient.SendMessage(new ANNDataMessage() { Id=0x3c, Field0=DynamicId, }); hero.InGameClient.FlushOutgoingBuffer(); hero.RevealedActors.Remove(this); }
public void Destroy(Hero hero) { if (!hero.RevealedScenes.Contains(this)) return; //not revealed yet if (SceneData != null) { hero.InGameClient.SendMessage(new DestroySceneMessage() { Id = 0x35, Field0 = SceneData.WorldID, Field1 = ID }); hero.InGameClient.FlushOutgoingBuffer(); hero.RevealedScenes.Remove(this); } }
public void Reveal(Hero hero) { if (hero.RevealedScenes.Contains(this)) return; //already revealed if (SceneData != null) { hero.InGameClient.SendMessage(SceneData); hero.RevealedScenes.Add(this); } if (Map != null) hero.InGameClient.SendMessage(Map); hero.InGameClient.FlushOutgoingBuffer(); }
//uncomment this constructor to show all portals in the world, even those that will crash the client on entry //useful for determining which actor the portal is. //public Portal() //{ // TargetPos = new Vector3D(); //} public void Reveal(Hero hero) { if (PortalMessage != null && ActorRef != null && TargetPos!=null) //targetpos!=null in this case is used to detect if the portal has been completely initialized to have a target //if it doesn't have one, it won't be displayed - otherwise the client would crash from this. { //Logger.Info("Revealing portal: " + PortalMessage.AsText()); ActorRef.Reveal(hero); hero.InGameClient.SendMessage(new AffixMessage() { Id = 0x48, Field0 = ActorRef.Id, Field1 = 1, aAffixGBIDs = new int[0] }); hero.InGameClient.SendMessage(new AffixMessage() { Id = 0x48, Field0 = ActorRef.Id, Field1 = 2, aAffixGBIDs = new int[0] }); hero.InGameClient.SendMessage(PortalMessage); hero.InGameClient.SendMessage(new ACDCollFlagsMessage() { Id = 0x00A6, Field0 = ActorRef.Id, Field1 = 0x00000001, }); hero.InGameClient.SendMessage(new AttributesSetValuesMessage() { Id = 0x004D, Field0 = ActorRef.Id, atKeyVals = new NetAttributeKeyValue[7] { new NetAttributeKeyValue() { Attribute = GameAttribute.Attributes[0x02BC], // MinimapActive Int = 0x00000001, Float = 0f, }, new NetAttributeKeyValue() { Attribute = GameAttribute.Attributes[0x0056], // Hitpoints_Max_Total Int = 0x00000000, Float = 1f, }, new NetAttributeKeyValue() { Attribute = GameAttribute.Attributes[0x0054], // Hitpoints_Max Int = 0x00000000, Float = 0.0009994507f, }, new NetAttributeKeyValue() { Attribute = GameAttribute.Attributes[0x0051], // Hitpoints_Total_From_Level Int = 0x00000000, Float = 3.051758E-05f, }, new NetAttributeKeyValue() { Attribute = GameAttribute.Attributes[0x004D], // Hitpoints_Cur Int = 0x00000000, Float = 0.0009994507f, }, new NetAttributeKeyValue() { Attribute = GameAttribute.Attributes[0x0043], // TeamID Int = 0x00000001, Float = 0f, }, new NetAttributeKeyValue() { Attribute = GameAttribute.Attributes[0x0026], // Level Int = 0x00000001, Float = 0f, }, }, }); hero.InGameClient.SendMessage(new ACDGroupMessage() { Id = 0x00B8, Field0 = ActorRef.Id, Field1 = -1, Field2 = -1, }); hero.InGameClient.SendMessage(new ANNDataMessage() { Id = 0x003E, Field0 = ActorRef.Id, }); hero.InGameClient.SendMessage(new ACDTranslateFacingMessage() { Id = 0x0070, Field0 = ActorRef.Id, Field1 = 0f, Field2 = false, }); } hero.InGameClient.FlushOutgoingBuffer(); }
public Inventory(Hero owner) { this.owner = owner; backpack = new int[6, 10]; equipment = new int[8]; }
public void DropItem(Hero hero, Item item, Vector3D postition) { Random random = new Random(); Actor itemActor = new Actor() { GBHandle = new GBHandle() { Field0 = 2, Field1 = item.Gbid, }, InventoryLocationData = null, Scale = 1.35f, Position = postition, WorldId = hero.WorldId, RotationAmount = 0.768145f, RotationAxis = new Vector3D() { X = 0f, Y = 0f, Z = (float)random.NextDouble(), }, SnoId = item.SNOId, DynamicId = item.ItemId, }; GetWorld(hero.WorldId).AddActor(itemActor); itemActor.Reveal(hero); item.Reveal(hero); hero.InGameClient.PacketId += 10 * 2; hero.InGameClient.SendMessage(new DWordDataMessage() { Id = 0x89, Field0 = hero.InGameClient.PacketId, }); hero.InGameClient.FlushOutgoingBuffer(); }
private void SpawnGold(Hero hero, Vector3D position) { ItemTypeGenerator itemGenerator = new ItemTypeGenerator(hero.InGameClient); Item item = itemGenerator.CreateItem("Gold1", 0x00000178, ItemType.Gold); item.Count = RandomHelper.Next(1, 3); DropItem(hero, item, position); }
public void DestroyWorld(Hero hero) { //for (int x = hero.RevealedActors.Count - 1; x >= 0; x-- ) // if (hero.RevealedActors[x].RevealMessage.Field4.Field2 == WorldID) hero.RevealedActors[x].Destroy(hero); //for (int x = hero.RevealedScenes.Count - 1; x >= 0; x--) // if (hero.RevealedScenes[x].SceneData.WorldID == WorldID) hero.RevealedScenes[x].Destroy(hero); //hero.Owner.LoggedInBNetClient.InGameClient.SendMessage(new WorldDeletedMessage() { Id = 0xd9, Field0 = WorldID, }); hero.InGameClient.FlushOutgoingBuffer(); }
public void Reveal(Hero hero) { bool found=hero.RevealedWorlds.Contains(this); if (!found) { //reveal world to player hero.InGameClient.SendMessage(new RevealWorldMessage() { Id = 0x0037, Field0 = WorldID, Field1 = WorldSNO, }); hero.RevealedWorlds.Add(this); } //player enters world hero.InGameClient.SendMessage(new EnterWorldMessage() { Id = 0x0033, Field0 = hero.Position, Field1 = WorldID, Field2 = WorldSNO, }); //just reveal the whole thing to the player for now foreach (var scene in Scenes) scene.Reveal(hero); if (!found) { //reveal actors foreach (var actor in Actors) { if (SNODatabase.Instance.IsOfGroup(actor.SnoId, SNOGroup.Blacklist)) continue; if (SNODatabase.Instance.IsOfGroup(actor.SnoId, SNOGroup.NPCs)) continue; // Commenting this out since it will lag the client to hell with all actors revealed // TODO: We need proper location-aware reveal logic for _all_ objects; even world chunks //actor.Reveal(hero); } //reveal portals Logger.Info("Revealing portals for world " + WorldID); foreach (Portal portal in Portals) { portal.Reveal(hero); } } }
public void Reveal(Hero hero) { bool found=hero.RevealedWorlds.Contains(this); if (!found) { //reveal world to player hero.InGameClient.SendMessage(new RevealWorldMessage() { Id = 0x0037, Field0 = WorldID, Field1 = WorldSNO, }); hero.RevealedWorlds.Add(this); } //player enters world hero.InGameClient.SendMessage(new EnterWorldMessage() { Id = 0x0033, Field0 = hero.Position, Field1 = WorldID, Field2 = WorldSNO, }); //just reveal the whole thing to the player for now foreach (var scene in Scenes) scene.Reveal(hero); if (!found) { //reveal actors foreach (var actor in Actors) { if (SNODatabase.Instance.IsOfGroup(actor.SnoId, SNOGroup.Blacklist)) continue; if (SNODatabase.Instance.IsOfGroup(actor.SnoId, SNOGroup.NPCs)) continue; if(actor.Id == 2065563791) actor.Reveal(hero); } //reveal portals Logger.Info("Revealing portals for world " + WorldID); foreach (Portal portal in Portals) { portal.Reveal(hero); } } }
public void RevealInInventory(Hero hero, int row, int column, int equipmentSlot) { InventoryLocationMessageData inventorylocation = new InventoryLocationMessageData() { Field0 = hero.Id, Field1 = equipmentSlot, Field2 = new IVector2D() { Field0 = row, Field1 = column, }, }; ACDEnterKnownMessage msg = new ACDEnterKnownMessage() { Id = 0x003B, Field0 = ItemId, Field1 = SnoId, Field2 = 0x0000001A, Field3 = 0x00000001, Field4 = null, Field5 = inventorylocation, Field6 = new GBHandle() { Field0 = 0x00000002, Field1 = Gbid, }, Field7 = -1, Field8 = -1, Field9 = 0x00000001, Field10 = 0x00, }; hero.InGameClient.SendMessage(msg); Reveal(hero); }
private void SpawnRandomDrop(Hero hero, Vector3D postition) { ItemTypeGenerator itemGenerator = new ItemTypeGenerator(hero.InGameClient); // randomize ItemType ItemType[] allValues = (ItemType[])Enum.GetValues(typeof(ItemType)); ItemType type = allValues[RandomHelper.Next(allValues.Length)]; Item item = itemGenerator.GenerateRandomElement(type); DropItem(hero, item, postition); }
public void Reveal(Hero hero) { GameClient client = hero.InGameClient; int[] affixGbis = new int[AffixList.Count]; for (int i = 0; i < AffixList.Count; i++) { affixGbis[i] = AffixList[i].AffixGbid; } client.SendMessage(new AffixMessage() { Id = 0x0048, Field0 = ItemId, Field1 = 0x00000001, aAffixGBIDs = affixGbis, }); client.SendMessage(new AffixMessage() { Id = 0x0048, Field0 = ItemId, Field1 = 0x00000002, aAffixGBIDs = affixGbis, }); client.SendMessage(new ACDCollFlagsMessage() { Id = 0x00A6, Field0 = ItemId, Field1 = 0x00000080, }); SendAttributes(AttributeList, client); client.SendMessage(new ACDGroupMessage() { Id = 0x00B8, Field0 = ItemId, Field1 = -1, Field2 = -1, }); client.SendMessage(new ANNDataMessage() { Id = 0x003E, Field0 = ItemId, }); client.SendMessage(new SNONameDataMessage() { Id = 0x00D3, Field0 = new SNOName() { Field0 = 0x00000001, Field1 = SnoId, }, }); /* * in the original dump this was sent. But don't know for what its good for * foreach (NetAttributeKeyValue attr in netAttributesList){ client.SendMessage(new AttributeSetValueMessage() { Id = 0x004C, Field0 = ItemId, Field1 = attr, }); }; */ client.SendMessage(new PlayEffectMessage() { Id = 0x007A, Field0 = ItemId, Field1 = 0x00000027, }); client.SendMessage(new ACDInventoryUpdateActorSNO() { Id = 0x0041, Field0 = ItemId, Field1 = SnoId, }); client.FlushOutgoingBuffer(); }
//uncomment this constructor to show all portals in the world, even those that will crash the client on entry //useful for determining which actor the portal is. //public Portal() //{ // TargetPos = new Vector3D(); //} public void Reveal(Hero hero) { if (PortalMessage != null && ActorRef != null && TargetPos!=null) //targetpos!=null in this case is used to detect if the portal has been completely initialized to have a target //if it doesn't have one, it won't be displayed - otherwise the client would crash from this. { //Logger.Info("Revealing portal: " + PortalMessage.AsText()); ActorRef.Reveal(hero); hero.InGameClient.SendMessage(new AffixMessage() { Id = 0x48, Field0 = ActorRef.DynamicId, Field1 = 1, aAffixGBIDs = new int[0] }); hero.InGameClient.SendMessage(new AffixMessage() { Id = 0x48, Field0 = ActorRef.DynamicId, Field1 = 2, aAffixGBIDs = new int[0] }); hero.InGameClient.SendMessage(PortalMessage); hero.InGameClient.SendMessage(new ACDCollFlagsMessage() { Id = 0x00A6, Field0 = ActorRef.DynamicId, Field1 = 0x00000001, }); GameAttributeMap attributes = new GameAttributeMap(); attributes[GameAttribute.MinimapActive] = true; attributes[GameAttribute.Hitpoints_Max_Total] = 1f; attributes[GameAttribute.Hitpoints_Max] = 0.0009994507f; attributes[GameAttribute.Hitpoints_Total_From_Level] = 3.051758E-05f; attributes[GameAttribute.Hitpoints_Cur] = 0.0009994507f; attributes[GameAttribute.TeamID] = 1; attributes[GameAttribute.Level] = 1; attributes.SendMessage(hero.InGameClient, ActorRef.DynamicId); hero.InGameClient.SendMessage(new ACDGroupMessage() { Id = 0x00B8, Field0 = ActorRef.DynamicId, Field1 = -1, Field2 = -1, }); hero.InGameClient.SendMessage(new ANNDataMessage() { Id = 0x003E, Field0 = ActorRef.DynamicId, }); hero.InGameClient.SendMessage(new ACDTranslateFacingMessage() { Id = 0x0070, Field0 = ActorRef.DynamicId, Field1 = 0f, Field2 = false, }); } hero.InGameClient.FlushOutgoingBuffer(); }