本文整理汇总了C#中Character.getMap方法的典型用法代码示例。如果您正苦于以下问题:C# Character.getMap方法的具体用法?C# Character.getMap怎么用?C# Character.getMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character.getMap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setPlayerPosition
public static void setPlayerPosition(Character chr, float goX, float goY, short map)
{
MartialClient c = chr.getAccount().mClient;
Logger.WriteLog(Logger.LogTypes.Debug, goX + " | " + goY + " | " + map);
Area lastArea = chr.getArea();
Area newArea = WMap.Instance.getGrid(map).getAreaByRound(goX, goY);
if(newArea == null)
{
StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "The position " + goX + "|" + goY + "|" + map + " can't be reached.");
Waypoint closestTown = TownCoordsCache.Instance.getClosestWaypointForMap(map, new Waypoint(goX, goY));
if(closestTown == null)
{
Area vvArea = WMap.Instance.getGrid(1).getAreaByRound(-1660, 2344);
if(vvArea == null)
{
Logger.WriteLog(Logger.LogTypes.Error, "Pure setPlayerPosition error {0}|{1}|{2}", goX, goY, map);
StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "We're sorry, but an hard error has occured. Please report it to an admin.");
c.Close();
return;
} else {
goX = -1660;
goY = 2344;
map = 1;
newArea = vvArea;
}
} else {
goX = closestTown.getX();
goY = closestTown.getY();
newArea = WMap.Instance.getGrid(map).getAreaByRound(goX, goY);
}
}
if(lastArea != null)
{
WMap.Instance.getGrid(chr.getMap()).sendTo3x3AreaLeave(chr, lastArea);
lastArea.removeCharacter(chr);
}
if(newArea != null)
chr.setArea(newArea);
else
{
chr.getAccount().mClient.Close();
return;
}
newArea.addCharacter(chr);
chr.setMap(map);
chr.setPosition(new float[] { goX, goY });
OutPacket op = new OutPacket(5840);
op.WriteInt(5824);
op.WriteShort(4); // 4 - 5
op.WriteShort(1); // 6 - 7
op.WriteInt(1); // 8 - 11
op.WriteInt(chr.getuID()); // 12 - 15
op.WriteShort(1); // 16 - 19
op.WriteShort(1); // 16 - 19
op.WriteInt(chr.getMap()); // 20 - 23
op.WriteInt(DateTime.Now.Year - 2000); // 24 - 27
op.WriteByte((byte)DateTime.Now.Month); // 28
op.WriteByte(DateTime.Now.Day > 30 ? (byte)0x1e : (byte)DateTime.Now.Day); // 29
op.WriteInt(DateTime.Now.Hour); // 30 - 37
for(int i=0;i<120;i++) {
if(chr.getCargo().getSeqSaved()[i] != -1 && chr.getCargo().getCargoSaved()[chr.getCargo().getSeqSaved()[i]] != null) {
op.WriteInt();
op.WriteByte((byte)(chr.getCargo().getSeqSaved()[i] / 100));
op.WriteByte((byte)(chr.getCargo().getSeqSaved()[i] % 100));
Item item = chr.getCargo().getCargoSaved()[chr.getCargo().getSeqSaved()[i]];
op.WriteInt(item.getItemID());
ItemData itemData = ItemDataCache.Instance.getItemData(item.getItemID());
if(itemData.getTimeToExpire() > 0) {
}
op.WriteShort(item.getQuantity());
} else op.WriteZero(12);
} // 38 - 1477
op.Position = 1476;
for(int i=0;i<chr.getCommunity().getFriendsList().Capacity;i++) {
if(chr.getCommunity().getFriendsList().ElementAtOrDefault(i) != null) {
op.WritePaddedString(chr.getCommunity().getFriendsList()[i], 17);
} else op.WriteZero(17);
} // 1476 - 1934
op.WriteRepeatedByte(0x58, 40);
op.Position = 1986;
for(int i = 0;i < chr.getCommunity().getIgnoresList().Capacity;i++) {
if(chr.getCommunity().getIgnoresList().ElementAtOrDefault(i) != null) {
op.WritePaddedString(chr.getCommunity().getIgnoresList()[i], 17);
} else op.WriteZero(17);
} // 1987 - 2157
//.........这里部分代码省略.........
示例2: warpToNearestTown
public static void warpToNearestTown(Character chr)
{
Waypoint closestTown = TownCoordsCache.Instance.getClosestWaypointForMap(chr.getMap(), new Waypoint(chr.getPosition()[0], chr.getPosition()[1]));
if(closestTown == null)
{
Area vvArea = WMap.Instance.getGrid(1).getAreaByRound(-1660, 2344);
if(vvArea == null)
{
Logger.WriteLog(Logger.LogTypes.Error, "Pure warpToNearestTown error {0}|{1}|{2}", chr.getPosition()[0], chr.getPosition()[1], chr.getMap());
StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "We're sorry, but an hard error has occured. Please report it to an admin.");
chr.getAccount().mClient.Close();
return;
} setPlayerPosition(chr, -1660, 2344, 1);
}
}
示例3: refreshCharacterForTheWorld
public static void refreshCharacterForTheWorld(Character chr)
{
WMap.Instance.getGrid(chr.getMap()).sendTo3x3AreaLeave(chr, chr.getArea());
WMap.Instance.getGrid(chr.getMap()).sendTo3x3AreaSpawn(chr, chr.getArea(), true);
}