本文整理汇总了C#中PacketReader.Int32方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.Int32方法的具体用法?C# PacketReader.Int32怎么用?C# PacketReader.Int32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketReader
的用法示例。
在下文中一共展示了PacketReader.Int32方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GuildTransferLeaderShip
void GuildTransferLeaderShip()
{
try
{
//Read packet data
PacketReader Reader = new PacketReader(PacketInformation.buffer);
int Guildid = Reader.Int32();
int Memberid = Reader.Int32();
Reader.Close();
//Grab the information of the player
Systems sys = GetPlayerid(Memberid);
//Update database
DB.query("UPDATE guild_members SET guild_rank='10',guild_perm_join='0',guild_perm_withdraw='0',guild_perm_union='0',guild_perm_storage='0',guild_perm_notice='0' WHERE guild_member_id='" + Character.Information.CharacterID + "'");
DB.query("UPDATE guild_members SET guild_rank='0',guild_perm_join='1',guild_perm_withdraw='1',guild_perm_union='1',guild_perm_storage='1',guild_perm_notice='1' WHERE guild_member_id='" + Memberid + "'");
//Send required packets to network
foreach (int member in Character.Network.Guild.Members)
{
//Make sure member s not null
if (member != 0)
{
//Get information for the guildmember
Systems guildmember = GetPlayerMainid(member);
//Make sure the guildmember isnt null
if (guildmember != null)
{
//Bool check single send packet
if (!guildmember.Character.Network.Guild.SingleSend)
{
//Send update packet
guildmember.client.Send(Packet.GuildUpdate(Character, 3, Memberid, 0 , 0));
guildmember.LoadPlayerGuildInfo(false);
}
}
}
}
//Disable bool
foreach (int member in Character.Network.Guild.Members)
{
if (member != 0)
{
Systems guildmember = GetPlayerMainid(member);
if (guildmember != null)
{
guildmember.Character.Network.Guild.SingleSend = false;
}
}
}
//Send message to old owner
client.Send(Packet.GuildTransferMessage());
}
catch (Exception ex)
{
Console.WriteLine("Guild Transfer Error: {0}", ex);
Log.Exception(ex);
}
}
示例2: GuildPromote
void GuildPromote()
{
try
{
//Read client information int32 id
PacketReader reader = new PacketReader(PacketInformation.buffer);
int guildid = reader.Int32();
reader.Close();
//Incase of hacking attempt :)
if (Character.Network.Guild.Level == 5) return;
//Define int's to use
int goldneeded;
int guildpoints;
bool promoting = false;
if (!promoting)
{
LoadPlayerGuildInfo(false);
promoting = true;
switch (Character.Network.Guild.Level)
{
case 1:
goldneeded = 3000000;
guildpoints = 5400;
break;
case 2:
goldneeded = 9000000;
guildpoints = 50400;
break;
case 3:
goldneeded = 15000000;
guildpoints = 135000;
break;
case 4:
goldneeded = 21000000;
guildpoints = 378000;
break;
default:
return;
}
int changelevel = Character.Network.Guild.Level + 1;
int storageslots = Character.Network.Guild.StorageSlots + 30;
if (Character.Information.Gold < goldneeded)
{
client.Send(Packet.ErrorMsg(SERVER_GUILD_PROMOTE_MSG, ErrorMsg.UIIT_MSG_ERROR_GUILD_LEVEL_UP_GOLD_DEFICIT));
return;
}
//Not enough guildpoints
if (Character.Network.Guild.PointsTotal < guildpoints)
{
client.Send(Packet.ErrorMsg(SERVER_GUILD_PROMOTE_MSG, ErrorMsg.UIIT_MSG_ERROR_GUILD_LEVEL_UP_GP_DEFICIT));
}
//Max level
if (Character.Network.Guild.Level == 5)
{
client.Send(Packet.ErrorMsg(SERVER_GUILD_PROMOTE_MSG, ErrorMsg.UIIT_MSG_ERROR_GUILD_LEVEL_UP_FULL));
return;
}
else
//Upgrade guild initiate
{
//If max level return just incase.
if (Character.Network.Guild.Level == 5) return;
//Reduct guildpoints
Character.Network.Guild.PointsTotal -= guildpoints;
//If the upgrade is final upgrade set points to 0
if (Character.Network.Guild.Level == 4) Character.Network.Guild.PointsTotal = 0;
//Reduct gold
Character.Information.Gold -= goldneeded;
client.Send(Packet.InfoUpdate(1, Character.Network.Guild.PointsTotal, 0));
client.Send(Packet.GuildPromoteMsgS());
//Update guild in database
DB.query("UPDATE guild SET guild_level='" + changelevel + "',guild_points='" + Character.Network.Guild.PointsTotal + "',guild_storage_slots='" + storageslots + "' WHERE guild_name='" + Character.Network.Guild.Name + "'");
//Send Guild Packets
foreach (int member in Character.Network.Guild.Members)
{
if (member != 0)
{
Systems memberinfo = GetPlayerMainid(member);
if (memberinfo != null)
{
memberinfo.LoadPlayerGuildInfo(false);
memberinfo.client.Send(Packet.GuildUpdate(Character, 5, 0, 0, 0));
}
}
}
// save
SaveGold();
client.Send(Packet.UpdateGold(Character.Information.Gold));
}
}
promoting = false;
}
catch (Exception ex)
{
Console.WriteLine("Guild Promote Error: {0}", ex);
//.........这里部分代码省略.........
示例3: GuildTitle
void GuildTitle()
{
//Wrap our function inside a catcher
try
{
//Extra hack check
if (Character.Network.Guild.Level < 4) return;
//Open our packet reader
PacketReader Reader = new PacketReader(PacketInformation.buffer);
int Selecteduser = Reader.Int32();
short TitleL = Reader.Int16();
string Title = Reader.String(TitleL);
Reader.Close();
//Get character information
Systems playerinfo = GetPlayerMainid(Selecteduser);
//Make sure the user is still there
if (playerinfo.Character != null)
{
//Update database set new title
DB.query("UPDATE guild_members SET guild_grant='" + Title + "' WHERE guild_member_id='" + playerinfo.Character.Information.CharacterID + "'");
//Send title update to send list
Send(Packet.GuildSetTitle(Character.Guild.GuildID, playerinfo.Character.Information.Name, Title));
//Send Final packet to client
client.Send(Packet.GuildSetTitle2(Character.Guild.GuildID, Selecteduser, Title));
}
foreach (int member in Character.Network.Guild.Members)
{
if (member != 0)
{
Systems getplayer = GetPlayerMainid(member);
if (getplayer != null)
{
getplayer.LoadPlayerGuildInfo(false);
}
}
}
}
catch (Exception ex)
{
Console.WriteLine("Guild Title Error: {0}", ex);
Log.Exception(ex);
}
}
示例4: GuildPermissions
/////////////////////////////////////////////////////////////////////////
//Guild Permissions
/////////////////////////////////////////////////////////////////////////
void GuildPermissions()
{
try
{
PacketReader Reader = new PacketReader(PacketInformation.buffer);
Reader.Byte();
int memberid = Reader.Int32();
byte permissions = (byte)Reader.Int32();
char[] bits = new char[8];
for (int i = 0; i < 8; ++i) bits[i] = (char)0;
bits = Convert.ToString(permissions, 2).ToCharArray();
Reader.Close();
// set the amount to the target player :)
int targetindex = Character.Network.Guild.MembersInfo.FindIndex(i => i.MemberID == memberid);
if (Character.Network.Guild.MembersInfo[targetindex].Online)
{
Systems member = GetPlayerMainid(memberid);
// so here we can set chars right
member.Character.Network.Guild.joinRight = bits[4] == '1' ? true : false;
member.Character.Network.Guild.withdrawRight = bits[3] == '1' ? true : false;
member.Character.Network.Guild.unionRight = bits[2] == '1' ? true : false;
member.Character.Network.Guild.guildstorageRight = bits[0] == '1' ? true : false;
member.Character.Network.Guild.noticeeditRight = bits[1] == '1' ? true : false;
}
// set new amount to every guild members guild class
foreach (int m in Character.Network.Guild.Members)
{
int index = Character.Network.Guild.MembersInfo.FindIndex(i => i.MemberID == m);
if (Character.Network.Guild.MembersInfo[index].Online)
{
Systems sys = Helpers.GetInformation.GetPlayerMainid(m);
// here comes the messy way
Global.guild_player mygp = new Global.guild_player();
int myindex = 0;
foreach (Global.guild_player gp in sys.Character.Network.Guild.MembersInfo)
{
if (gp.MemberID == memberid)
{
mygp = gp; //
mygp.joinRight = bits[4] == '1' ? true : false;
mygp.withdrawRight = bits[3] == '1' ? true : false;
mygp.unionRight = bits[2] == '1' ? true : false;
mygp.guildstorageRight = bits[0] == '1' ? true : false;
mygp.noticeeditRight = bits[1] == '1' ? true : false;
break;
}
myindex++;
}
sys.Character.Network.Guild.MembersInfo[myindex] = mygp;
}
}
DB.query("UPDATE guild_members SET guild_perm_join='" + bits[4] + "',guild_perm_withdraw='" + bits[3] + "',guild_perm_union='" + bits[2] + "',guild_perm_storage='" + bits[0] + "',guild_perm_notice='" + bits[1] + "' WHERE guild_member_id='" + memberid + "'");
Character.Network.Guild.Send(Packet.GuildUpdate(Character, 4, 0, permissions, 0));
}
catch (Exception ex)
{
Console.WriteLine("Guild permission error: {0}", ex);
Log.Exception(ex);
}
}
示例5: GuildCreate
void GuildCreate()
{
try
{
//Extra check if user is allready in guild.
if (Character.Network.Guild.Guildid != 0) return;
//Read client packet ObjData.Manager.
PacketReader Reader = new PacketReader(PacketInformation.buffer);
int infoid = Reader.Int32();
short guildname = Reader.Int16();
string guildnameinfo = Reader.String(guildname);
string charactername = Character.Information.Name;
Reader.Close();
//Will write global class for special chars later.
if (guildnameinfo.Contains("[")) return;
if (guildnameinfo.Contains("]")) return;
if (guildnameinfo.Contains("(")) return;
if (guildnameinfo.Contains(")")) return;
if (guildnameinfo.Contains("@")) return;
if (guildnameinfo.Contains("#")) return;
if (guildnameinfo.Contains("$")) return;
if (guildnameinfo.Contains("^")) return;
if (guildnameinfo.Contains("&")) return;
if (guildnameinfo.Contains("*")) return;
if (guildnameinfo.Contains("+")) return;
if (guildnameinfo.Contains("=")) return;
if (guildnameinfo.Contains("~")) return;
if (guildnameinfo.Contains("`")) return;
//Check length lower are 4 return
if (guildnameinfo.Length < 4) return;
//Check if guild name is taken or not.
int guildcheckname = DB.GetRowsCount("SELECT * FROM guild WHERE guild_name='" + guildnameinfo + "'");
//If name excists
if (guildcheckname == 1)
{
//Need to sniff packet
return;
}
//Set the gold requirements 500.000 retail info
int goldrequired = 500000;
//If character level is to low
if (Character.Information.Level < 20)
{
client.Send(Packet.GuildCreateLow());
return;
}
//If gold is lower then price of creating a guild
else if (Character.Information.Gold < goldrequired)
{
client.Send(Packet.ErrorMsg(SERVER_GUILD, ErrorMsg.UIIT_MSG_GUILDERR_NOT_ENOUGH_GOLD));
return;
}
//All checks ok, continue creating new guild.
else
{
//Reduct the gold required from player gold
Character.Information.Gold -= goldrequired;
//Save player information
SavePlayerInfo();
//Insert guild into database
DB.query("INSERT INTO guild (guild_name, guild_level, guild_points, guild_news_t, guild_news_m, guild_members_t, guild_master_id) VALUES ('" + guildnameinfo + "','1','0','" + "" + "','" + "" + "','1','" + Character.Information.CharacterID + "')");
//Get guild id
string guildid = DB.GetData("SELECT id FROM guild WHERE guild_name='" + guildnameinfo + "'", "id");
int docount = Convert.ToInt32(guildid);
//Insert member into database
DB.query("INSERT INTO guild_members (guild_id, guild_member_id, guild_rank, guild_points, guild_fortress, guild_grant, guild_perm_join, guild_perm_withdraw, guild_perm_union, guild_perm_storage, guild_perm_notice) VALUES ('" + docount + "','" + Character.Information.CharacterID + "','0','0','1','','1','1','1','1','1')");
//Load our new guild
LoadPlayerGuildInfo(false);
//Private packet
client.Send(Packet.Guild_Create(Character.Network.Guild));
//Public spawn packet
Send(Packet.SendGuildInfo2(Character));
}
}
catch (Exception ex)
{
Log.Exception(ex);
}
}
示例6: DonateGP
void DonateGP()
{
//First we write our function inside a catcher
try
{
//Max level of guild wont allow new gp donations.
if (Character.Network.Guild.Level == 5)
{
client.Send(Packet.ErrorMsg(SERVER_GUILD_PROMOTE_MSG, ErrorMsg.UIIT_MSG_GUILD_LACK_GP));
return;
}
//Open our packet reader
PacketReader reader = new PacketReader(PacketInformation.buffer);
int donatedgp = reader.Int32();
reader.Close();
//Anti hack checking (If donated gp higher is then the player skillpoints.
if (donatedgp > Character.Information.SkillPoint) return;
//Calculate total
int totalgp = Character.Network.Guild.PointsTotal + donatedgp;
//First we write our base information to use
Character.Network.Guild.PointsTotal += donatedgp;
Character.Information.SkillPoint -= donatedgp;
//Save our information (Skill points).
SavePlayerInfo();
//Update database information
DB.query("UPDATE guild SET guild_points='" + totalgp + "' WHERE guild_name='" + Character.Network.Guild.Name + "'");
//Update packets for each member in the guild
//Send packets to donator.
client.Send(Packet.InfoUpdate(1, totalgp, 0));
client.Send(Packet.GuildDonateGP(donatedgp));
foreach (int member in Character.Network.Guild.Members)
{
//Make sure that the member isnt null
if (member != 0)
{
//Now we get the detailed information for each member
Systems guildmember = GetPlayerMainid(member);
//Make sure the guildmember is still there
if (guildmember != null)
{
//Send packet only once
if (!guildmember.Character.Network.Guild.SingleSend)
{
//Set bool true so it only sends once
guildmember.Character.Network.Guild.SingleSend = true;
//Send packet data to the player
guildmember.client.Send(Packet.GuildUpdate(Character, 13, 0, 0, totalgp));
guildmember.client.Send(Packet.GuildUpdate(Character, 9, 0, 0, totalgp));
guildmember.LoadPlayerGuildInfo(false);
}
}
}
}
//Disable the bool again
foreach (int member in Character.Network.Guild.Members)
{
//Make sure member isnt null
if (member != 0)
{
//Get guildmember details
Systems guildmember = GetPlayerMainid(member);
//Make sure guildmember isnt null
if (guildmember != null)
{
//Disable bool to allow resend new packets.
guildmember.Character.Network.Guild.SingleSend = false;
}
}
}
}
catch (Exception ex)
{
Console.WriteLine("Donate GP Error {0}", ex);
Log.Exception(ex);
}
}
示例7: HandleRegisterIcon
void HandleRegisterIcon()
{
try
{
PacketReader reader = new PacketReader(PacketInformation.buffer);
byte type = reader.Byte();
int iconlenght = reader.Int32();
string icon = reader.Text();
reader.Close();
string convertedicon = ConvertToHex(icon);
//Save output to .dat file in hex formatting.
}
catch (Exception ex)
{
Console.WriteLine("Guild icon register error {0}", ex);
}
}
示例8: GuildWarGold
/////////////////////////////////////////////////////////////////////////
//Guild War
/////////////////////////////////////////////////////////////////////////
void GuildWarGold()
{
try
{
PacketReader Reader = new PacketReader(PacketInformation.buffer);
int guildid = Reader.Int32();
Reader.Close();
if (Character.Guild.GuildWarGold == 0)
{
//Send Packet Message No War Gold Received
client.Send(Packet.GuildWarMsg(2));
}
else
{
//Sniff packet for war gold
}
}
catch (Exception ex)
{
Log.Exception(ex);
}
}