当前位置: 首页>>代码示例>>C#>>正文


C# GameClient类代码示例

本文整理汇总了C#中GameClient的典型用法代码示例。如果您正苦于以下问题:C# GameClient类的具体用法?C# GameClient怎么用?C# GameClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GameClient类属于命名空间,在下文中一共展示了GameClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Logout

        public static void Logout(GameClient client)
        {
            if (client.Account == null)
                return;

            var account = client.Account;

            using (var context = new GameDatabaseContext())
            {
                context.Accounts.Attach(account);

                account.IsOnline = false;

                context.SaveChanges();
            }

            client.Account = null;

            if (client.Zone == null)
                return;

            if (client.Hero == null)
                return;

            client.Zone.OnClientLeave(client);
        }
开发者ID:GrindFest,项目名称:GrindFest,代码行数:26,代码来源:LoginHandler.cs

示例2: Execute

        public override void Execute(GameClient session, string[] pms)
        {
            var user = AzureEmulator.GetHabboForName(pms[0]);

            if (user == null)
            {
                session.SendWhisper(TextManager.GetText("user_not_found"));
                return;
            }
            if (user.Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(TextManager.GetText("user_is_higher_rank"));
                return;
            }
            using (var adapter = AzureEmulator.GetDatabaseManager().GetQueryReactor())
            {
                adapter.SetQuery("DELETE FROM users_bans WHERE value = @name");
                adapter.AddParameter("name", user.UserName);
                adapter.RunQuery();
                AzureEmulator.GetGame()
                    .GetModerationTool()
                    .LogStaffEntry(session.GetHabbo().UserName, user.UserName, "Unban",
                        string.Format("User has been Unbanned [{0}]", pms[0]));
                return;
            }
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:26,代码来源:UnBanUser.cs

示例3: OnCharacterCreate

        public static void OnCharacterCreate(GameClient client, ClientLoadingFinishedPacket packet)
        {
            var player = client.HeroEntity;
            var zone = player.Zone;

            zone.TryAndAddPlayer(player);
        }
开发者ID:gitter-badger,项目名称:OpenORPG,代码行数:7,代码来源:HeroSelectionHandler.cs

示例4: Execute

        public override void Execute(GameClient session, string[] pms)
        {
            var user = AzureEmulator.GetGame().GetClientManager().GetClientByUserName(pms[0]);

            if (user == null)
            {
                session.SendWhisper(TextManager.GetText("user_not_found"));
                return;
            }
            if (user.GetHabbo().Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(TextManager.GetText("user_is_higher_rank"));
                return;
            }
            try
            {
                var length = int.Parse(pms[1]);

                var message = pms.Length < 3 ? string.Empty : string.Join(" ", pms.Skip(2));
                if (string.IsNullOrWhiteSpace(message)) message = TextManager.GetText("command_ban_user_no_reason");

                ModerationTool.BanUser(session, user.GetHabbo().Id, length, message);
                AzureEmulator.GetGame()
                    .GetModerationTool()
                    .LogStaffEntry(session.GetHabbo().UserName, user.GetHabbo().UserName, "Ban",
                        string.Format("USER:{0} TIME:{1} REASON:{2}", pms[0], pms[1], message));
            }
            catch
            {

                // error handle
            }
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:33,代码来源:BanUser.cs

示例5: OnCommand

		public void OnCommand(GameClient client, string[] args)
		{
			if (IsSpammingCommand(client.Player, "boot"))
				return;

            House house = client.Player.CurrentHouse;
			if (house == null)
			{
                DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Boot.InHouseError"));
				return;
			}

			// no permission to banish, return
			if (!house.CanBanish(client.Player))
			{
				DisplayMessage(client, "You do not have permissions to do that.");
				return;
			}

			// check each player, try and find player with the given name (lowercase cmp)
			foreach (GamePlayer player in house.GetAllPlayersInHouse())
			{
				if (player != client.Player && player.Name.ToLower() != args[1].ToLower())
				{
					ChatUtil.SendSystemMessage(client, "Scripts.Players.Boot.YouRemoved", client.Player.Name);
					player.LeaveHouse();

					return;
				}
			}

			ChatUtil.SendHelpMessage(client, "Scripts.Players.Boot.NoOneOnline", null);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:33,代码来源:boot.cs

示例6: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			ushort keepId = packet.ReadShort();
			ushort wallId = packet.ReadShort();
			int hookpointID = packet.ReadShort();
            ushort itemslot = packet.ReadShort();
			int payType = packet.ReadByte();//gold RP BP contrat???
			int unk2 = packet.ReadByte();
			int unk3 = packet.ReadByte();
			int unk4 = packet.ReadByte();
//			client.Player.Out.SendMessage("x="+unk2+"y="+unk3+"z="+unk4,eChatType.CT_Say,eChatLoc.CL_SystemWindow);
			AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId);
			if (keep == null) return;
			GameKeepComponent component = keep.KeepComponents[wallId] as GameKeepComponent;
			if (component == null) return;
			/*GameKeepHookPoint hookpoint = component.HookPoints[hookpointID] as GameKeepHookPoint;
			if (hookpoint == null) return 1;
			*/
			HookPointInventory inventory = null;
			if(hookpointID > 0x80) inventory = HookPointInventory.YellowHPInventory; //oil
			else if(hookpointID > 0x60) inventory = HookPointInventory.GreenHPInventory;//big siege
			else if(hookpointID > 0x40) inventory = HookPointInventory.LightGreenHPInventory; //small siege
			else if (hookpointID > 0x20) inventory = HookPointInventory.BlueHPInventory;//npc
			else inventory = HookPointInventory.RedHPInventory;//guard

			if (inventory != null)
			{
				HookPointItem item = inventory.GetItem(itemslot);
				if (item != null)
					item.Invoke(client.Player, payType, component.HookPoints[hookpointID] as GameKeepHookPoint, component);
			}
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:32,代码来源:BuyHookPointHandler.cs

示例7: OnCommand

        public void OnCommand(GameClient client, string[] args)
        {
            if (client.Player.Guild == null)
            {
                DisplayMessage(client, "You don't belong to a player guild.");
                return;
            }

            if (!client.Player.Guild.HasRank(client.Player, Guild.eRank.OcSpeak))
            {
                DisplayMessage(client, "You don't have permission to speak on the officer line.");
                return;
            }

            if (IsSpammingCommand(client.Player, "osend", 500))
            {
                DisplayMessage(client, "Slow down! Think before you say each word!");
                return;
            }

            string message = "[Officers] " + client.Player.Name + ": \"" + string.Join(" ", args, 1, args.Length - 1) + "\"";
            foreach (GamePlayer ply in client.Player.Guild.GetListOfOnlineMembers())
            {
                if (!client.Player.Guild.HasRank(ply, Guild.eRank.OcHear))
                {
                    continue;
                }
                ply.Out.SendMessage(message, eChatType.CT_Officer, eChatLoc.CL_ChatWindow);
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:30,代码来源:guildchat.cs

示例8: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            uint x = packet.ReadInt();
            uint y = packet.ReadInt();
            ushort id = packet.ReadShort();
            ushort item_slot = packet.ReadShort();

            if (client.Player.TargetObject == null)
            {
                client.Out.SendMessage("You must select an NPC to sell to.", eChatType.CT_Merchant, eChatLoc.CL_SystemWindow);
                return;
            }

            lock (client.Player.Inventory)
            {
                InventoryItem item = client.Player.Inventory.GetItem((eInventorySlot)item_slot);
                if (item == null)
                    return;

                int itemCount = Math.Max(1, item.Count);
                int packSize = Math.Max(1, item.PackSize);

                if (client.Player.TargetObject is GameMerchant)
                {
                    //Let the merchant choos how to handle the trade.
                    ((GameMerchant)client.Player.TargetObject).OnPlayerSell(client.Player, item);
                }
                else if (client.Player.TargetObject is GameLotMarker)
                {
                    ((GameLotMarker)client.Player.TargetObject).OnPlayerSell(client.Player, item);
                }
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:33,代码来源:PlayerSellRequestHandler.cs

示例9: OnTrigger

        public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
        {
            if (!hasRights)
                return;
            if (item == null || item.GetBaseItem() == null || item.GetBaseItem().InteractionType != Interaction.Gate)
                return;

            var modes = item.GetBaseItem().Modes - 1;
            if (modes <= 0)
                item.UpdateState(false, true);

            if (item.GetRoom() == null || item.GetRoom().GetGameMap() == null || item.GetRoom().GetGameMap().SquareHasUsers(item.X, item.Y))
                return;

            int currentMode;
            int.TryParse(item.ExtraData, out currentMode);
            int newMode;
            if (currentMode <= 0)
                newMode = 1;
            else if (currentMode >= modes)
                newMode = 0;
            else
                newMode = currentMode + 1;

            if (newMode == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y))
                return;

            item.ExtraData = newMode.ToString();
            item.UpdateState();
            item.GetRoom().GetGameMap().UpdateMapForItem(item);
            item.GetRoom().GetWiredHandler().ExecuteWired(Interaction.TriggerStateChanged, item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item);
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:32,代码来源:InteractorGate.cs

示例10: HandlePacket

        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            ushort unk1 = packet.ReadShort();
            ushort questIndex = packet.ReadShort();
            ushort unk2 = packet.ReadShort();
            ushort unk3 = packet.ReadShort();

            AbstractQuest quest = null;

            int index = 0;
            lock (client.Player.QuestList)
            {
                foreach (AbstractQuest q in client.Player.QuestList)
                {
                    // ignore completed quests
                    if (q.Step == -1)
                        continue;

                    if (index == questIndex)
                    {
                        quest = q;
                        break;
                    }

                    index++;
                }
            }

            if (quest != null)
                quest.AbortQuest();
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:31,代码来源:QuestRemoveRequestHandler.cs

示例11: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			var aggroState = (byte) packet.ReadByte(); // 1-Aggressive, 2-Deffensive, 3-Passive
			var walkState = (byte) packet.ReadByte(); // 1-Follow, 2-Stay, 3-GoTarg, 4-Here
			var command = (byte) packet.ReadByte(); // 1-Attack, 2-Release

			//[Ganrod] Nidel: Animist can removed his TurretFnF without MainPet.
			if (client.Player.TargetObject != null && command == 2 && client.Player.ControlledBrain == null &&
			    client.Player.CharacterClass.ID == (int) eCharacterClass.Animist)
			{
				var turret = client.Player.TargetObject as TurretPet;
				if (turret != null && turret.Brain is TurretFNFBrain && client.Player.IsControlledNPC(turret))
				{
					//release
					new HandlePetCommandAction(client.Player, 0, 0, 2).Start(1);
					return;
				}
			}

			//[Ganrod] Nidel: Call only if player has controllednpc
			if (client.Player.ControlledBrain != null)
			{
				new HandlePetCommandAction(client.Player, aggroState, walkState, command).Start(1);
				return;
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:26,代码来源:PetWindowHandler.cs

示例12: Execute

        public override void Execute(GameClient session, string[] pms)
        {
            var client = AzureEmulator.GetGame().GetClientManager().GetClientByUserName(pms[0]);
            if (client == null)
            {
                session.SendWhisper(TextManager.GetText("user_not_found"));
                return;
            }
            if (client.GetHabbo().Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(TextManager.GetText("user_is_higher_rank"));
                return;
            }
            int time;
            if (!int.TryParse(pms[1], out time))
            {
                session.SendWhisper(TextManager.GetText("enter_numbers"));
                return;
            }

            client.GetHabbo().FloodTime = AzureEmulator.GetUnixTimeStamp() + Convert.ToInt32(pms[1]);
            var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("FloodFilterMessageComposer"));
            serverMessage.AppendInteger(Convert.ToInt32(pms[1]));
            client.SendMessage(serverMessage);
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:25,代码来源:FloodUser.cs

示例13: HandlePacket

		public void HandlePacket(GameClient client, GSPacketIn packet)
		{
			int permissionSlot = packet.ReadByte();
			int newPermissionLevel = packet.ReadByte();
			ushort houseNumber = packet.ReadShort();

			// house is null, return
			var house = HouseMgr.GetHouse(houseNumber);
			if (house == null)
				return;

			// player is null, return
			if (client.Player == null)
				return;

			// can't set permissions unless you're the owner.
			if (!house.HasOwnerPermissions(client.Player) && client.Account.PrivLevel <= 1)
				return;

			// check if we're setting or removing permissions
			if (newPermissionLevel == 100)
			{
				house.RemovePermission(permissionSlot);
			}
			else
			{
				house.AdjustPermissionSlot(permissionSlot, newPermissionLevel);
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:29,代码来源:HouseUsersPermissionsSetHandler.cs

示例14: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int id = packet.ReadInt();
            bool result = false;
            string msg = "ConsortiaApplyLoginPassHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                int consortiaRepute = 0;
                ConsortiaUserInfo info = new ConsortiaUserInfo();
                if (db.PassConsortiaApplyUsers(id, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, client.Player.PlayerCharacter.ConsortiaID, ref msg, info, ref consortiaRepute))
                {
                    msg = "ConsortiaApplyLoginPassHandler.Success";
                    result = true;
                    if (info.UserID != 0)
                    {
                        info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
                        info.ConsortiaName = client.Player.PlayerCharacter.ConsortiaName;
                        GameServer.Instance.LoginServer.SendConsortiaUserPass(client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, info, false, consortiaRepute, info.LoginName, client.Player.PlayerCharacter.FightPower);
                    }
                }
            }

            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:31,代码来源:ConsortiaApplyLoginPassHandler.cs

示例15: OnResponse

        public override void OnResponse( GameClient sender, RelayInfo info )
        {
            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if ( pm == null )
                return;

            if ( !pm.InRange( m_Owner.Location, 5 ) )
                return;

            switch ( info.ButtonID )
            {
                case 2: // Yes, and do not ask me again
                    {
                        pm.DisabledPvpWarning = true;
                        pm.SendLocalizedMessage( 1113796 ); // You may use your avatar's context menu to re-enable the warning later.

                        goto case 1;
                    }
                case 1: // Yes, I wish to proceed
                    {
                        BaseCreature.TeleportPets( pm, m_Owner.PointDest, m_Owner.MapDest );
                        pm.MoveToWorld( m_Owner.PointDest, m_Owner.MapDest );

                        break;
                    }
                case 0: // No, I do not wish to proceed
                    {
                        break;
                    }
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:32,代码来源:PvpWarningGump.cs


注:本文中的GameClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。