本文整理汇总了C#中Character.getAccount方法的典型用法代码示例。如果您正苦于以下问题:C# Character.getAccount方法的具体用法?C# Character.getAccount怎么用?C# Character.getAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character.getAccount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: sendAreaInit
public void sendAreaInit(Character character)
{
MartialClient connection = character.getAccount().mClient;
if (character.getInnitedAreas().Contains(this.aID)) return;
foreach(Character aCharacter in areaCharacters) {
if(aCharacter == character) continue;
try {
Console.WriteLine("AreaInt> Packet sent for {0} from {1}", character.getName(), aCharacter.getName());
connection.WriteRawPacket(CharacterPackets.extCharPacket(aCharacter));
} catch(Exception e) { Console.WriteLine(e); }
}
foreach (NPC aNPC in npcs) {
try {
connection.WriteRawPacket(aNPC.npcSpawn(character));
} catch (Exception e) { Console.WriteLine(e); }
}
foreach(Mob aMob in mobs) {
try {
connection.WriteRawPacket(aMob.getInitialPacket());
} catch(Exception e) { Console.WriteLine(e); }
}
}
示例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: 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: calculateCharacterStatistics
public static void calculateCharacterStatistics(Character chr)
{
Boolean[] pureHeal = new Boolean[] { chr.getCurHP() == chr.getMaxHP(), chr.getCurMP() == chr.getMaxMP(), chr.getCurSP() == chr.getMaxSP() };
chr.getEquipment().calculateEquipStats();
short bonusMaxhp = 0;
//if(bonusAttributes.containsKey("maxhp"))
// bonusMaxhp = (Short)bonusAttributes.get("maxhp");
short bonusDmg = 0;
//if(bonusAttributes.containsKey("bonusDmg"))
// bonusDmg = (Short)bonusAttributes.get("bonusDmg");
short bonusAtkSucces = 0;
//if(bonusAttributes.containsKey("bonusAtkSucces"))
// bonusAtkSucces = (Short)bonusAttributes.get("bonusAtkSucces");
short[] stats = new short[5];
short[] eqstats = chr.getEquipment().getStats();
for(int i = 0;i < 5;i++)
{
stats[i] = (short)(chr.getCStats()[i] + eqstats[i]);
}
chr.setMaxHP((int)(30 + bonusMaxhp + chr.getEquipment().getHp() + stats[0] * 2.2 + stats[1] * 2.4 + stats[2] * 2.5 + stats[3] * 1.6 + stats[4] * 1.5));
chr.setMaxMP((short)(30 + chr.getEquipment().getMana() + stats[0] * 1.4 + stats[1] * 1.7 + stats[2] * 1.5 + stats[3] * 3.5 + stats[4] * 1.5));
chr.setMaxSP((short)(30 + chr.getEquipment().getStamina() + stats[0] * 0.9 + stats[1] * 1.3 + stats[2] * 1.5 + stats[3] * 1.7 + stats[4] * 1.3));
chr.setRegHP((short)(stats[2] / 2 + stats[0] / 4));
chr.setRegMP((short)(stats[3] / 2 + stats[1] / 4));
chr.setRegSP((short)(stats[4] * 0.1));
chr.setAtk((int)(chr.getLevel() / 2 + chr.getEquipment().getAtk() + stats[0] * 0.53 + stats[1] * 0.5 + stats[2] * 0.44 + stats[3] * 0.25 + stats[4] * 0.25)
+ chr.getEquipment().getMaxDmg());
chr.setDef((int)(chr.getLevel() / 2 + chr.getEquipment().getDeff() + stats[0] * 0.28 + stats[1] * 0.3 + stats[2] * 0.53 + stats[3] * 0.22 + stats[4] * 0.42));
chr.setMinDmg((int)(bonusDmg + chr.getEquipment().getMinDmg()));
chr.setMaxDmg((int)(bonusDmg + chr.getEquipment().getMaxDmg()));
chr.setBasicAtkSuc((int)(stats[0] * 0.5 + stats[1] * 0.6 + stats[2] * 0.3 + stats[3] * 1 + stats[4] * 0.8 + chr.getLevel() * 6));
chr.setBasicDefSuc((int)(stats[0] * 0.2 + stats[1] * 0.2 + stats[2] * 0.5 + stats[3] * 0.7 + stats[4] * 0.6 + chr.getLevel() * 4));
chr.setBasicCritRate((int)(stats[0] * 0.1 + stats[1] * 1 + stats[2] * 0.1 + stats[3] * 0.5 + stats[4] * 0.3 + chr.getLevel() * 2) - 300);
chr.setAdditionalAtkSuc(1000 + bonusAtkSucces);
chr.setAdditionalDefSuc(500);
chr.setAdditionalCritRate(2000);
float atkSucMul = chr.getEquipment().getAtkSucMul();
float defSucMul = chr.getEquipment().getDefSucMul();
float critRateMul = chr.getEquipment().getCritRateMul();
chr.setAtkSuc((int)(chr.getBasicAtkSuc() + chr.getAdditionalAtkSuc() * atkSucMul));
chr.setDefSuc((int)(chr.getBasicDefSuc() + chr.getAdditionalDefSuc() * defSucMul));
chr.setCritRate((int)(chr.getBasicCritRate() + chr.getAdditionalCritRate() * critRateMul));
chr.setCritDmg((short)(chr.getEquipment().getCritDmg() + stats[1] - 10));
if(chr.getCurHP() > chr.getMaxHP())
chr.setCurHP(chr.getMaxHP());
if(chr.getCurMP() > chr.getMaxMP())
chr.setCurMP(chr.getMaxMP());
if(chr.getCurSP() > chr.getMaxSP())
chr.setCurSP(chr.getMaxSP());
if(chr.getAccount().activeCharacter != null)
{
if(chr.getAccount().activeCharacter == chr)
{
StaticPackets.releaseHealPacket(chr, pureHeal[0] ? chr.getMaxHP() : chr.getCurHP(),
pureHeal[1] ? chr.getMaxMP() : chr.getCurMP(),
pureHeal[2] ? chr.getMaxSP() : chr.getCurSP());
}
}
Console.WriteLine("{0} {1}", chr.getAtk(), chr.getDef());
}
示例5: soldItem
public Boolean soldItem(Character buy, long price, byte index, int invSlot, int x, int y, short amount)
{
if(buy.getCoin() - (price * amount) < 0 || owner.getCoin() + (price*amount) > long.MaxValue)
{
Console.WriteLine("Let me show you, where i've been.");
return false;
}
if(!itemsMap.ContainsKey(index))
{
Console.WriteLine("no shit sherlock, item doesn't exist!");
return false;
}
ItemVendor item = itemsMap[index];
if(item == null)
{
Console.WriteLine("Item does not exist!");
return false;
}
if(amount > item.getQuantity())
{
Console.WriteLine("This is not the right amount.");
return false;
}
buy.setCoin(owner.getCoin() - (price * amount));
owner.setCoin(owner.getCoin() + (price * amount));
//when item not deleted
if(item.getQuantity() > 1 && amount != item.getQuantity()) {
item.decrementAmount(amount);
//replace with new values in vendor
itemsMap[index] = item;
}
else {
//remove item vendor
removeItemList(index);
}
//remove/decrement item
owner.getInventory().updateInv();
if(!owner.getInventory().removeItem(invSlot, amount))
{
Console.WriteLine("chuj kurwa");
return false;
}
owner.getInventory().saveInv();
//add item
Item newItem = new Item(item.getItemID(), item.getQuantity());
Console.WriteLine("ItemID: " + newItem.getItemID());
buy.getInventory().updateInv();
if(!buy.getInventory().addItem(y, x, newItem))
{
Console.WriteLine("Something went wrong while adding the item");
return false;
}
buy.getInventory().saveInv();
buy.getAccount().mClient.WriteRawPacket(VendingPackets.buyItemFromVendor(buy, owner, index, invSlot, x, y, amount));
owner.getAccount().mClient.WriteRawPacket(VendingPackets.buyItemFromVendorSecondSite(buy, owner, index, invSlot, x, y, amount));
return true;
}
示例6: open
public void open(Character open, int vendorId)
{
open.getAccount().mClient.WriteRawPacket(VendingPackets.openVendorFrame(open, itemsMap, itemCoords, owner.getuID(), vendorId));
}