本文整理汇总了C#中Character.getArea方法的典型用法代码示例。如果您正苦于以下问题:C# Character.getArea方法的具体用法?C# Character.getArea怎么用?C# Character.getArea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character.getArea方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: npcSpawn
public byte[] npcSpawn(Character character)
{
OutPacket initNPCData = new OutPacket(615);
initNPCData.WriteInt(615);
initNPCData.WriteShort(0x04);
initNPCData.WriteShort(0x04);
initNPCData.WriteByte(0x01);
initNPCData.WriteInt(character.getuID());
initNPCData.WriteInt(character.getArea().getaID());
initNPCData.WriteFloat(character.getPosition()[0]);
initNPCData.WriteFloat(character.getPosition()[1]);
initNPCData.WriteByte(3);
initNPCData.WriteInt(this.uID);
initNPCData.WriteInt();
initNPCData.WritePaddedString(this.getName(), 16);
initNPCData.Skip(18);
initNPCData.WriteInt(this.getModule());
initNPCData.Skip(10);
initNPCData.WriteInt(this.getmID());
initNPCData.Skip(16);
initNPCData.WriteFloat(this.npcPosition[0]);
initNPCData.WriteFloat(this.npcPosition[1]);
initNPCData.Skip(502);
initNPCData.WriteByte(0x22);
initNPCData.WriteByte(0x08);
return initNPCData.ToArray();
}
示例2: sendTo3x3AreaLeave
public void sendTo3x3AreaLeave(Character character, Area area)
{
if(!this.areaExists(area)) return;
for (int i =0; i < 3; i++) {
for (int u =0; u < 3; u++) {
Area nearCentral = getArea(new int[] { area.getAreaPosition()[0]-1+i, area.getAreaPosition()[1]-1+u });
if(nearCentral == null) continue;
foreach(Character characterAround in nearCentral.getCharacters()) {
if(characterAround == character) continue;
try {
Console.WriteLine("AreaLeave> vanPacket from: {0} for {1}", character.getName(), characterAround.getName());
characterAround.getAccount().mClient.WriteRawPacket(CharacterPackets.vanCharPacket(character));
} catch (Exception e) { Console.WriteLine(e); }
}
}
}
character.getArea().removeCharacter(character);
character.removeInnitedAreas();
WMap.Instance.removeFromSynchronizedAreas(area);
}
示例3: 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
//.........这里部分代码省略.........
示例4: 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);
}