本文整理汇总了C#中GameClient.LoadPlayer方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.LoadPlayer方法的具体用法?C# GameClient.LoadPlayer怎么用?C# GameClient.LoadPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameClient
的用法示例。
在下文中一共展示了GameClient.LoadPlayer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int packetVersion;
switch (client.Version)
{
case GameClient.eClientVersion.Version168:
case GameClient.eClientVersion.Version169:
case GameClient.eClientVersion.Version170:
case GameClient.eClientVersion.Version171:
case GameClient.eClientVersion.Version172:
case GameClient.eClientVersion.Version173:
packetVersion = 168;
break;
default:
packetVersion = 174;
break;
}
packet.Skip(4); //Skip the first 4 bytes
if (packetVersion == 174)
{
packet.Skip(1);
}
string charName = packet.ReadString(28);
//TODO Character handling
if (charName.Equals("noname"))
{
client.Out.SendSessionID();
}
else
{
// SH: Also load the player if client player is NOT null but their charnames differ!!!
// only load player when on charscreen and player is not loaded yet
// packet is sent on every region change (and twice after "play" was pressed)
if (
(
(client.Player == null && client.Account.Characters != null)
|| (client.Player != null && client.Player.Name.ToLower() != charName.ToLower())
) && client.ClientState == GameClient.eClientState.CharScreen)
{
bool charFound = false;
for (int i = 0; i < client.Account.Characters.Length; i++)
{
if (client.Account.Characters[i] != null
&& client.Account.Characters[i].Name == charName)
{
charFound = true;
client.LoadPlayer(i);
break;
}
}
if (charFound == false)
{
client.Player = null;
client.ActiveCharIndex = -1;
}
else
{
// Log character play
AuditMgr.AddAuditEntry(client, AuditType.Character, AuditSubtype.CharacterLogin, "", charName);
}
}
if (client.Player == null)
{
// client keeps sending the name of the deleted char even if new one was created, correct name only after "play" button pressed
//client.Server.Error(new Exception("ERROR, active character not found!!! name="+charName));
}
client.Out.SendSessionID();
}
}
示例2: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int packetVersion;
switch (client.Version)
{
case GameClient.eClientVersion.Version168:
case GameClient.eClientVersion.Version169:
case GameClient.eClientVersion.Version170:
case GameClient.eClientVersion.Version171:
case GameClient.eClientVersion.Version172:
case GameClient.eClientVersion.Version173:
packetVersion = 168;
break;
default:
packetVersion = 174;
break;
}
packet.Skip(4); //Skip the first 4 bytes
if (packetVersion == 174)
{
packet.Skip(1);
}
string charName = packet.ReadString(28);
// WHRIA START
if (charName.Length >= 5)
{
if (charName.Substring(0, 4) == "slot")
{
int iSelected = 0;
if (charName.Substring(4, 1) == "a") iSelected = 0;
if (charName.Substring(4, 1) == "b") iSelected = 1;
if (charName.Substring(4, 1) == "c") iSelected = 2;
if (charName.Substring(4, 1) == "d") iSelected = 3;
if (charName.Substring(4, 1) == "e") iSelected = 4;
if (charName.Substring(4, 1) == "f") iSelected = 5;
if (charName.Substring(4, 1) == "g") iSelected = 6;
if (charName.Substring(4, 1) == "h") iSelected = 7;
if (charName.Substring(4, 1) == "i") iSelected = 8;
if (charName.Substring(4, 1) == "j") iSelected = 9;
int sizeOfCharacter = client.Account.Characters.Length;
for (int j = 0; j < sizeOfCharacter; j++)
{
int iSlot = client.Account.Characters[j].AccountSlot;
if (iSlot >= 300) iSlot -= 300; if (iSlot >= 200) iSlot -= 200; if (iSlot >= 100) iSlot -= 100;
if (iSlot == iSelected)
{
Regex nameCheck = new Regex("^[A-Z][a-zA-Z]");
if (!nameCheck.IsMatch(client.Account.Characters[j].Name)
&& client.Account.Characters[j] != null)
{
charName = client.Account.Characters[j].Name;
}
}
}
}
}
// END
//TODO Character handling
if (charName.Equals("noname"))
{
client.Out.SendSessionID();
}
else
{
// SH: Also load the player if client player is NOT null but their charnames differ!!!
// only load player when on charscreen and player is not loaded yet
// packet is sent on every region change (and twice after "play" was pressed)
if (
(
(client.Player == null && client.Account.Characters != null)
|| (client.Player != null && client.Player.Name.ToLower() != charName.ToLower())
) && client.ClientState == GameClient.eClientState.CharScreen)
{
bool charFound = false;
for (int i = 0; i < client.Account.Characters.Length; i++)
{
if (client.Account.Characters[i] != null
&& client.Account.Characters[i].Name == charName)
{
charFound = true;
// Notify Character Selection Event, last hope to fix any bad data before Loading.
GameEventMgr.Notify(DatabaseEvent.CharacterSelected, new CharacterEventArgs(client.Account.Characters[i], client));
client.LoadPlayer(i);
break;
}
}
if (charFound == false)
{
client.Player = null;
client.ActiveCharIndex = -1;
}
else
//.........这里部分代码省略.........
示例3: HandlePacket
public void HandlePacket(GameClient client, GSPacketIn packet)
{
int packetVersion;
switch (client.Version)
{
case GameClient.eClientVersion.Version168:
case GameClient.eClientVersion.Version169:
case GameClient.eClientVersion.Version170:
case GameClient.eClientVersion.Version171:
case GameClient.eClientVersion.Version172:
case GameClient.eClientVersion.Version173:
packetVersion = 168;
break;
default:
packetVersion = 174;
break;
}
packet.Skip(4); //Skip the first 4 bytes
if (packetVersion == 174)
{
packet.Skip(1);
}
string charName = packet.ReadString(28);
//TODO Character handling
if (charName.Equals("noname"))
{
client.Out.SendSessionID();
}
else
{
// SH: Also load the player if client player is NOT null but their charnames differ!!!
// only load player when on charscreen and player is not loaded yet
// packet is sent on every region change (and twice after "play" was pressed)
if (
(
(client.Player == null && client.Account.Characters != null)
|| (client.Player != null && client.Player.Name.ToLower() != charName.ToLower())
) && client.ClientState == GameClient.eClientState.CharScreen)
{
bool charFound = false;
for (int i = 0; i < client.Account.Characters.Length; i++)
{
if (client.Account.Characters[i] != null
&& client.Account.Characters[i].Name == charName)
{
charFound = true;
// Notify Character Selection Event, last hope to fix any bad data before Loading.
GameEventMgr.Notify(DatabaseEvent.CharacterSelected, new CharacterEventArgs(client.Account.Characters[i], client));
client.LoadPlayer(i);
break;
}
}
if (charFound == false)
{
client.Player = null;
client.ActiveCharIndex = -1;
}
else
{
// Log character play
AuditMgr.AddAuditEntry(client, AuditType.Character, AuditSubtype.CharacterLogin, "", charName);
}
}
client.Out.SendSessionID();
}
}