You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
3.2 KiB
106 lines
3.2 KiB
/*
|
|
地图相关gm指令
|
|
Instance
|
|
Map
|
|
Grid
|
|
Nav
|
|
Npc
|
|
Move
|
|
*/
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.IO;
|
|
|
|
using Sog;
|
|
using ProtoCSStruct;
|
|
using Sog.IO;
|
|
using LitJson;
|
|
using System.Text;
|
|
|
|
|
|
namespace Game
|
|
{
|
|
public partial class GmCmdSvc
|
|
{
|
|
[GmApiMapping("伪造一个玩家")]
|
|
public int AddFakePlayer(long userid, int uid)
|
|
{
|
|
if (uid >= 1000)
|
|
{
|
|
TraceLog.Error("GmCmdSvc.AddFakePlayer invalid uid {0}", uid);
|
|
return -1;
|
|
}
|
|
|
|
var player = GameServerUtils.GetPlayerTableOp().GetPlayerByUid(uid);
|
|
if (player != null)
|
|
{
|
|
TraceLog.Error("GmCmdSvc.AddFakePlayer uid {0} exist", uid);
|
|
return -1;
|
|
}
|
|
|
|
player = new PlayerOnGame(uid, 0);
|
|
player.UserID = uid;
|
|
player.RealmID = 1;
|
|
// player role不存DB
|
|
player.SaveReqWaitAckTimeout = int.MaxValue;
|
|
player.OnSaveReq(GameServerUtils.GetTimeMs());
|
|
player.DoNotSaveRole = true;
|
|
GameServerUtils.GetPlayerTableOp().AddPlayer(player);
|
|
|
|
var session = new PlayerSession(uid, 0);
|
|
session.Player = player;
|
|
GameServerUtils.GetPlayerTableOp().AddPlayerSession(uid, session);
|
|
|
|
// 去friend上addFakePlayer
|
|
var gm = new SSNotifyServerDealGMCmd();
|
|
gm.GmCmd.SetString("AddFakePlayer");
|
|
gm.CmdParams.SetString(string.Format("{0} {1}", uid, GameServerUtils.GetApp().ServerID));
|
|
GameServerUtils.GetPacketSender().SendToWorldServer((int)SSGameMsgID.DealgmcmdNotify, ref gm, uid);
|
|
|
|
TraceLog.Trace("GmCmdSvc.AddFakePlayer uid {0} succ", uid);
|
|
return 0;
|
|
}
|
|
|
|
public int GetFriendList(long userid, string[] cmdParams)
|
|
{
|
|
if (cmdParams.Length < 1)
|
|
{
|
|
TraceLog.Error("GmCmdSvc.GetFriendList no param, need uid");
|
|
return -1;
|
|
}
|
|
|
|
int.TryParse(cmdParams[0], out int uid);
|
|
TraceLog.Trace("GmCmdSvc.GetFriendList uid {0}", uid);
|
|
|
|
SSQueryFriendListReq ssreq = new SSQueryFriendListReq();
|
|
ssreq.Uid = uid;
|
|
GameServerUtils.GetPacketSender().SendToWorldServer((int)SSGameMsgID.QueryFriendListReq, ref ssreq, uid);
|
|
return 0;
|
|
}
|
|
|
|
public int FriendOp(long userid, string[] cmdParams)
|
|
{
|
|
if (cmdParams.Length < 3)
|
|
{
|
|
TraceLog.Error("GmCmdSvc.GetFriendList no param, need uid + friendUid + opType");
|
|
return -1;
|
|
}
|
|
|
|
int.TryParse(cmdParams[0], out int uid);
|
|
int.TryParse(cmdParams[1], out int friendUid);
|
|
int.TryParse(cmdParams[2], out int opType);
|
|
TraceLog.Trace("GmCmdSvc.GetFriendList uid {0} friend {1} opType {2}", uid, friendUid, opType);
|
|
|
|
CSFriendOpReq req = new CSFriendOpReq();
|
|
req.TargetUid = friendUid;
|
|
req.OpType = opType;
|
|
GameServerUtils.GetPacketSender().SendToWorldServer((int)CSGameMsgID.FriendOpReq, ref req, uid);
|
|
return 0;
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|