コード例 #1
0
        private void OnCharacterDetailRequest(INetworkConnection con, Packet r)
        {
            Log1.Logger("Zeus.Inbound.Client").Debug("Character detail request from " + ServerUser.AccountName + ".");

            PacketGenericMessage msg = r as PacketGenericMessage;
            int id = msg.Parms.GetIntProperty(2).GetValueOrDefault(-1);
            WispCharacterDetail ci = new WispCharacterDetail(id);
            string rmsg            = "";

            ServerUser su = new Shared.ServerUser();

            su.ID = Guid.Empty;
            ServerCharacterInfo sci = null;

            if (MyServer.RequireAuthentication)
            {
                sci = CharacterUtil.Instance.LoadCharacter(su, id, ref rmsg);
            }

            r.ReplyPacket = CreateStandardReply(r, ReplyType.OK, "");
            r.ReplyPacket.ReplyMessage = rmsg;

            if (sci == null)
            {
                r.ReplyPacket.ReplyCode    = ReplyType.Failure;
                r.ReplyPacket.ReplyMessage = "Character not found. " + rmsg;
            }
            else
            {
                ci.CharacterName = sci.CharacterInfo.CharacterName;
                ci.ID            = sci.ID;
                ci.LastLogin     = sci.LastLogin;
                ci.Properties    = sci.Properties;
                ci.Stats         = sci.Stats;

                r.ReplyPacket.Parms.SetProperty(2, ci as ISerializableWispObject);
            }

            r.ReplyPacket.Parms.SetProperty(1, MyServer.ServerUserID);
        }
コード例 #2
0
        private void OnCharacterDetailRequest(INetworkConnection con, Packet r)
        {
            Log1.Logger("Zeus.Inbound.Client").Debug("Character detail request from " + ServerUser.AccountName + ".");

            PacketGenericMessage msg = r as PacketGenericMessage;
            int id = msg.Parms.GetIntProperty(2).GetValueOrDefault(-1);
            WispCharacterDetail ci = new WispCharacterDetail(id);
            string rmsg = "";

            ServerUser su = new Shared.ServerUser();
            su.ID = Guid.Empty;
            ServerCharacterInfo sci = null;
            if (MyServer.RequireAuthentication)
            {
                sci = CharacterUtil.Instance.LoadCharacter(su, id, ref rmsg);
            }

            r.ReplyPacket = CreateStandardReply(r, ReplyType.OK, "");
            r.ReplyPacket.ReplyMessage = rmsg;

            if (sci == null)
            {
                r.ReplyPacket.ReplyCode = ReplyType.Failure;
                r.ReplyPacket.ReplyMessage = "Character not found. " + rmsg;
            }
            else
            {
                ci.CharacterName = sci.CharacterInfo.CharacterName;
                ci.ID = sci.ID;
                ci.LastLogin = sci.LastLogin;
                ci.Properties = sci.Properties;
                ci.Stats = sci.Stats;

                r.ReplyPacket.Parms.SetProperty(2, ci as ISerializableWispObject);
            }

            r.ReplyPacket.Parms.SetProperty(1, MyServer.ServerUserID);
        }