本文整理汇总了C#中RealmPacketIn.ReadInt32方法的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketIn.ReadInt32方法的具体用法?C# RealmPacketIn.ReadInt32怎么用?C# RealmPacketIn.ReadInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RealmPacketIn
的用法示例。
在下文中一共展示了RealmPacketIn.ReadInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleSaveTalentGroup
public static void HandleSaveTalentGroup(IRealmClient client, RealmPacketIn packet)
{
var count = packet.ReadInt32();
var talents = client.ActiveCharacter.Talents;
for (var i = 0; i < count; i++)
{
var talentId = (TalentId)packet.ReadUInt32();
var rank = packet.ReadInt32();
talents.Learn(talentId, rank);
}
SendTalentGroupList(talents);
}
示例2: HandleStopWatchingFaction
public static void HandleStopWatchingFaction(IRealmClient client, RealmPacketIn packet)
{
var reputationIndex = (FactionReputationIndex)packet.ReadInt32();
bool isInactive = packet.ReadBoolean();
client.ActiveCharacter.Reputations.SetInactive(reputationIndex, isInactive);
}
示例3: HandleSaveTalentGroup
public static void HandleSaveTalentGroup(IRealmClient client, RealmPacketIn packet)
{
var count = packet.ReadInt32();
var list = new List<SimpleTalentDescriptor>(count);
for (var i = 0; i < count; i++)
{
list.Add(new SimpleTalentDescriptor()
{
TalentId = (TalentId)packet.ReadUInt32(),
Rank = packet.ReadInt32()
});
}
var chr = client.ActiveCharacter.CurrentSpecProfile;
// TODO: Set Talent Group
//chr.SpecProfile.LearnTalentGroupTalents(list);
}
示例4: HandleLearnTalent
public static void HandleLearnTalent(IRealmClient client, RealmPacketIn packet)
{
var talentId = (TalentId)packet.ReadUInt32();
var rank = packet.ReadInt32(); // zero-based Rank-mask
client.ActiveCharacter.SpecProfile.LearnTalent(new SimpleTalentDescriptor() {
TalentId = talentId,
Rank = rank
});
}
示例5: HandleLearnTalent
public static void HandleLearnTalent(IRealmClient client, RealmPacketIn packet)
{
var talentId = (TalentId)packet.ReadUInt32();
var rank = packet.ReadInt32(); // zero-based Rank-mask
var talents = client.ActiveCharacter.Talents;
if (talents.Learn(talentId, rank) == null) return;
// send new talent group list
SendTalentGroupList(talents);
}
示例6: HandleChooseTitle
public static void HandleChooseTitle(IRealmClient client, RealmPacketIn packet)
{
var titleBit = packet.ReadInt32();
if (titleBit > 0)
{
if (!client.ActiveCharacter.HasTitle((TitleBitId)titleBit))
{
return;
}
}
else
{
titleBit = 0;
}
client.ActiveCharacter.ChosenTitle = (TitleBitId)titleBit;
}
示例7: AuthSessionRequest
public static void AuthSessionRequest(IRealmClient client, RealmPacketIn packet)
{
if (client.ActiveCharacter != null || client.Account != null)
{
// Already logged in
SendAuthSessionErrorReply(client, LoginErrorCode.AUTH_ALREADY_ONLINE);
client.Disconnect();
}
else if (!client.IsEncrypted)
{
var builtNumberClient = packet.ReadUInt32();
var new302 = packet.ReadUInt32(); // NEW 0.0.2.8970
var accName = packet.ReadCString();
var unk322 = packet.ReadUInt32();
client.ClientSeed = packet.ReadUInt32();
var unk1 = packet.ReadUInt32(); // 3.3.5a
var unk2 = packet.ReadUInt32(); // 3.3.5a
var unk3 = packet.ReadUInt32(); // 3.3.5a
var unk4 = packet.ReadUInt64();
client.ClientDigest = packet.ReadBigInteger(20);
#if DEBUG
log.Debug("builtNumberClient:{0} new302:{1} accName:{2} unk322:{3} client.ClientSeed:{4} unk4:{5} ClientDigest:{6}",
builtNumberClient,
new302, accName, unk322, client.ClientSeed, unk4, client.ClientDigest);
#endif
var decompressedDataLength = packet.ReadInt32();
var compressedData = packet.ReadBytes(packet.RemainingLength);
client.Addons = new byte[decompressedDataLength];
Compression.DecompressZLib(compressedData, client.Addons);
var acctLoadTask = Message.Obtain(() => RealmAccount.InitializeAccount(client, accName));
client.Server.AddMessage(acctLoadTask);
}
}
示例8: HandlePetLearnTalent
public static void HandlePetLearnTalent(IRealmClient client, RealmPacketIn packet)
{
var petGuid = packet.ReadEntityId();
var talentId = (TalentId)packet.ReadInt32();
var rank = packet.ReadInt32(); // 0 based rank
var chr = client.ActiveCharacter;
var pet = chr.Region.GetObject(petGuid) as NPC;
PetMgr.PetLearnTalent(chr, pet, talentId, rank + 1);
}
示例9: RandomRollRequest
public static void RandomRollRequest(IRealmClient client, RealmPacketIn packet)
{
int min = packet.ReadInt32();
int max = packet.ReadInt32();
if (min > max || max > 10000)
return;
var random = new Random();
var roll = random.Next(min, max);
var group = client.ActiveCharacter.Group;
if (group == null)
{
// no group, so send only to the requester
SendRoll(client, min, max, roll, client.ActiveCharacter.EntityId);
}
else
group.SendRoll(min, max, roll, client.ActiveCharacter.EntityId);
}
示例10: HandleBuyItem
public static void HandleBuyItem(IRealmClient client, RealmPacketIn packet)
{
var vendorId = packet.ReadEntityId();
var itemEntryId = packet.ReadUInt32();
//var slot = packet.ReadUInt32(); // slot in the vendor list
packet.ReadFloat(); // unknown float
//var count = packet.ReadUInt32();
var amount = packet.ReadInt32();
var chr = client.ActiveCharacter;
var vendor = chr.Region.GetObject(vendorId) as NPC;
if (vendor != null && vendor.IsVendor)
{
vendor.VendorEntry.BuyItem(chr, itemEntryId, chr.Inventory, amount, BaseInventory.INVALID_SLOT);
}
}
示例11: HandleBuyItemInSlot
public static void HandleBuyItemInSlot(IRealmClient client, RealmPacketIn packet)
{
var vendorId = packet.ReadEntityId();
var itemEntryId = packet.ReadUInt32();
var slot = packet.ReadUInt32();
var bagId = packet.ReadEntityId();
var bagSlot = packet.ReadByte();
var amount = packet.ReadInt32();
var chr = client.ActiveCharacter;
var vendor = chr.Region.GetObject(vendorId) as NPC;
if (vendor != null && vendor.IsVendor)
{
BaseInventory inv;
if (bagId.High == HighId.Item)
{
var bag = chr.Inventory.GetItemByLowId(bagId.Low) as Container;
if (bag != null)
{
inv = bag.BaseInventory;
}
else
{
// invalid Container
return;
}
}
else
{
inv = chr.Inventory;
}
vendor.VendorEntry.BuyItem(chr, itemEntryId, inv, amount, (int)slot);
}
}
示例12: HandleBuyBackItem
public static void HandleBuyBackItem(IRealmClient client, RealmPacketIn packet)
{
var vendorId = packet.ReadEntityId();
var slot = packet.ReadInt32();
var vendor = client.ActiveCharacter.Region.GetObject(vendorId) as NPC;
if (vendor != null && vendor.IsVendor)
{
//client.ActiveCharacter.SendMessage("Buyback is temporarily disabled.");
vendor.VendorEntry.BuyBackItem(client.ActiveCharacter, slot);
}
}
示例13: HandlePetitionBuy
public static void HandlePetitionBuy(IRealmClient client, RealmPacketIn packet)
{
var chr = client.ActiveCharacter;
var petitionerId = packet.ReadEntityId();
var petitioner = chr.Region.GetObject(petitionerId) as NPC;
//var petitionId = packet.ReadInt32();
//var petitionCreator = packet.ReadEntityId();
//packet.SkipBytes(4 + 8);
packet.Position += 4 + 8;
var name = packet.ReadCString().Trim();
//var bodytext = packet.ReadCString().Trim();
//var minSignatures = packet.ReadInt32();
//var maxSignatures = packet.ReadInt32();
//var deadline = packet.ReadInt32();
//var issueDate = packet.ReadInt32();
//var allowedGuildId = packet.ReadInt32();
//var allowedClassMask = packet.ReadInt32();
//var allowedRaceMask = packet.ReadInt32();
//var allowedGender = packet.ReadInt32(); // wow is sexist... :(
//var allowedMinLevel = packet.ReadInt32();
//var allowedMaxLevel = packet.ReadInt32();
//packet.SkipBytes(4 * 10);
//packet.Position += (7 * 8) + 2 + 1 + 8;
packet.Position += 4 * 10;
var choice = packet.ReadInt32();
//var petitionType = packet.ReadInt32();
//packet.SkipBytes(4);
packet.Position += 4;
if (petitioner != null && petitioner.IsPetitioner && petitioner.CheckVendorInteraction(chr))
{
ItemId itemId = 0;
uint cost = 0;
PetitionType type = PetitionType.None;
if (petitioner.IsGuildPetitioner)
{
if (chr.IsInGuild)
{
return;
}
if (!GuildMgr.IsValidGuildName(name))
{
GuildHandler.SendResult(chr, GuildCommandId.CREATE, name, GuildResult.NAME_INVALID);
return;
}
else if (GuildMgr.DoesGuildExist(name))
{
GuildHandler.SendResult(chr, GuildCommandId.CREATE, name, GuildResult.NAME_EXISTS);
return;
}
itemId = PetitionerEntry.GuildPetitionEntry.ItemId;
cost = GuildMgr.GuildCharterCost;
type = PetitionType.Guild;
}
else if (petitioner.IsArenaPetitioner)
{
switch (choice)
{
case 1:
itemId = PetitionerEntry.ArenaPetition2v2Entry.ItemId;
cost = PetitionerEntry.ArenaPetition2v2Entry.Cost;
type = PetitionType.Arena2vs2;
break;
case 2:
itemId = PetitionerEntry.ArenaPetition3v3Entry.ItemId;
cost = PetitionerEntry.ArenaPetition3v3Entry.Cost;
type = PetitionType.Arena3vs3;
break;
case 3:
itemId = PetitionerEntry.ArenaPetition5v5Entry.ItemId;
cost = PetitionerEntry.ArenaPetition5v5Entry.Cost;
type = PetitionType.Arena5vs5;
break;
default:
return;
}
if (!ArenaTeamMgr.IsValidArenaTeamName(name))
{
ArenaTeamHandler.SendResult(chr, ArenaTeamCommandId.CREATE, name, string.Empty, ArenaTeamResult.NAME_INVALID);
return;
}
else if (ArenaTeamMgr.DoesArenaTeamExist(name))
{
ArenaTeamHandler.SendResult(chr, ArenaTeamCommandId.CREATE, name, string.Empty, ArenaTeamResult.NAME_EXISTS);
return;
}
}
if (itemId != 0 && cost != 0 && type != PetitionType.None)
{
var templ = ItemMgr.GetTemplate(itemId);
if (templ == null)
{
SendBuyError(chr, petitioner, itemId, BuyItemError.CantFindItem);
}
else if (chr.Money < cost)
{
SendBuyError(chr, petitioner, itemId, BuyItemError.NotEnoughMoney);
//.........这里部分代码省略.........
示例14: SavePetTalentChanges
public static void SavePetTalentChanges(IRealmClient client, RealmPacketIn packet)
{
var petId = packet.ReadEntityId();
var chr = client.ActiveCharacter;
var pet = chr.Map.GetObject(petId) as NPC;
if (pet != null && pet.IsAlive)
{
if (pet == chr.ActivePet)
{
var count = packet.ReadInt32();
var talents = pet.Talents;
for (var i = 0; i < count; i++)
{
var talentId = (TalentId)packet.ReadUInt32();
var rank = packet.ReadInt32();
talents.Learn(talentId, rank);
}
TalentHandler.SendTalentGroupList(talents);
}
}
}
示例15: HandleSetWatchedFaction
public static void HandleSetWatchedFaction(IRealmClient client, RealmPacketIn packet)
{
var reputationIndex = packet.ReadInt32();
client.ActiveCharacter.WatchedFaction = reputationIndex;
}