public static void HandleClientEntityInteraction(WorldSession session, ClientEntityInteract entityInteraction) { switch (entityInteraction.Event) { case 37: // Quest NPC { session.EnqueueMessageEncrypted(new Server0357 { UnitId = entityInteraction.Guid }); break; } case 49: // Handle Vendor VendorHandler.HandleClientVendor(session, entityInteraction); break; case 68: // "MailboxActivate" var mailboxEntity = session.Player.Map.GetEntity <Mailbox>(entityInteraction.Guid); break; case 8: // "HousingGuildNeighborhoodBrokerOpen" case 40: case 41: // "ResourceConversionOpen" case 42: // "ToggleAbilitiesWindow" case 43: // "InvokeTradeskillTrainerWindow" case 45: // "InvokeShuttlePrompt" case 46: case 47: case 48: // "InvokeTaxiWindow" case 65: // "MannequinWindowOpen" case 66: // "ShowBank" case 67: // "ShowRealmBank" case 69: // "ShowDye" case 70: // "GuildRegistrarOpen" case 71: // "WarPartyRegistrarOpen" case 72: // "GuildBankerOpen" case 73: // "WarPartyBankerOpen" case 75: // "ToggleMarketplaceWindow" case 76: // "ToggleAuctionWindow" case 79: // "TradeskillEngravingStationOpen" case 80: // "HousingMannequinOpen" case 81: // "CityDirectionsList" case 82: // "ToggleCREDDExchangeWindow" case 84: // "CommunityRegistrarOpen" case 85: // "ContractBoardOpen" case 86: // "BarberOpen" case 87: // "MasterCraftsmanOpen" default: log.Warn($"Received unhandled interaction event {entityInteraction.Event} from Entity {entityInteraction.Guid}"); break; } }
public static void HandleClientVendor(WorldSession session, ClientEntityInteract vendor) { var vendorEntity = session.Player.Map.GetEntity <NonPlayer>(vendor.Guid); if (vendorEntity == null) { return; } if (vendorEntity.VendorInfo == null) { return; } session.Player.SelectedVendorInfo = vendorEntity.VendorInfo; var serverVendor = new ServerVendorItemsUpdated { Guid = vendor.Guid, SellPriceMultiplier = vendorEntity.VendorInfo.SellPriceMultiplier, BuyPriceMultiplier = vendorEntity.VendorInfo.BuyPriceMultiplier, Unknown2 = true, Unknown3 = true, Unknown4 = false }; foreach (EntityVendorCategoryModel category in vendorEntity.VendorInfo.Categories) { serverVendor.Categories.Add(new ServerVendorItemsUpdated.Category { Index = category.Index, LocalisedTextId = category.LocalisedTextId }); } foreach (EntityVendorItemModel item in vendorEntity.VendorInfo.Items) { serverVendor.Items.Add(new ServerVendorItemsUpdated.Item { Index = item.Index, ItemId = item.ItemId, CategoryIndex = item.CategoryIndex, Unknown6 = 0, UnknownB = new[] { new ServerVendorItemsUpdated.Item.UnknownItemStructure(), new ServerVendorItemsUpdated.Item.UnknownItemStructure() } }); } session.EnqueueMessageEncrypted(serverVendor); }
public static void HandleClientEntityInteraction(WorldSession session, ClientEntityInteract entityInteraction) { WorldEntity entity = session.Player.GetVisible <WorldEntity>(entityInteraction.Guid); if (entity != null) { session.Player.QuestManager.ObjectiveUpdate(QuestObjectiveType.ActivateEntity, entity.CreatureId, 1u); session.Player.QuestManager.ObjectiveUpdate(QuestObjectiveType.TalkTo, entity.CreatureId, 1u); foreach (uint targetGroupId in AssetManager.Instance.GetTargetGroupsForCreatureId(entity.CreatureId) ?? Enumerable.Empty <uint>()) { session.Player.QuestManager.ObjectiveUpdate(QuestObjectiveType.TalkToTargetGroup, targetGroupId, 1u); } } switch (entityInteraction.Event) { case 37: // Quest NPC { session.EnqueueMessageEncrypted(new Server0357 { UnitId = entityInteraction.Guid }); break; } case 49: // Handle Vendor VendorHandler.HandleClientVendor(session, entityInteraction); break; case 68: // "MailboxActivate" var mailboxEntity = session.Player.Map.GetEntity <Mailbox>(entityInteraction.Guid); break; case 8: // "HousingGuildNeighborhoodBrokerOpen" case 40: case 41: // "ResourceConversionOpen" case 42: // "ToggleAbilitiesWindow" case 43: // "InvokeTradeskillTrainerWindow" case 45: // "InvokeShuttlePrompt" case 46: case 47: case 48: // "InvokeTaxiWindow" case 65: // "MannequinWindowOpen" case 66: // "ShowBank" case 67: // "ShowRealmBank" case 69: // "ShowDye" case 70: // "GuildRegistrarOpen" case 71: // "WarPartyRegistrarOpen" case 72: // "GuildBankerOpen" case 73: // "WarPartyBankerOpen" case 75: // "ToggleMarketplaceWindow" case 76: // "ToggleAuctionWindow" case 79: // "TradeskillEngravingStationOpen" case 80: // "HousingMannequinOpen" case 81: // "CityDirectionsList" case 82: // "ToggleCREDDExchangeWindow" case 84: // "CommunityRegistrarOpen" case 85: // "ContractBoardOpen" case 86: // "BarberOpen" case 87: // "MasterCraftsmanOpen" default: log.Warn($"Received unhandled interaction event {entityInteraction.Event} from Entity {entityInteraction.Guid}"); break; } }