本文整理汇总了C#中MabiPacket.GetShort方法的典型用法代码示例。如果您正苦于以下问题:C# MabiPacket.GetShort方法的具体用法?C# MabiPacket.GetShort怎么用?C# MabiPacket.GetShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MabiPacket
的用法示例。
在下文中一共展示了MabiPacket.GetShort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompleteRegular
public SkillResults CompleteRegular(MabiCreature creature, MabiPacket packet, SkillConst skillId, uint part)
{
var x = packet.GetShort();
var y = packet.GetShort();
// Map for the selected slot
byte map = creature.Temp.SkillItem1.DataInfo.ColorMap1;
if (part == 1)
map = creature.Temp.SkillItem1.DataInfo.ColorMap2;
else if (part == 2)
map = creature.Temp.SkillItem1.DataInfo.ColorMap3;
// Imaginary index for the map
switch (map)
{
default:
case 1: map = 0xE0; break; // Cloth
case 2: map = 0xE1; break; // Leather
case 5: map = 0xE2; break; // Metal
case 23: map = 0xE3; break; // Weapon
case 24: map = 0xE4; break; // Hilt
}
// Random color from the available ones
var rndNr = (byte)RandomProvider.Get().Next(5);
x = (ushort)((x + creature.Temp.DyeCursors[rndNr * 4 + 0] - creature.Temp.DyeCursors[rndNr * 4 + 1]) & 0xFF);
y = (ushort)((y + creature.Temp.DyeCursors[rndNr * 4 + 2] - creature.Temp.DyeCursors[rndNr * 4 + 3]) & 0xFF);
rndNr += 1;
// Change color
var color = MabiData.ColorMapDb.GetAt(map, x -= 1, y -= 1);
switch (part)
{
default:
case 0: creature.Temp.SkillItem1.Info.ColorA = color; break;
case 1: creature.Temp.SkillItem1.Info.ColorB = color; break;
case 2: creature.Temp.SkillItem1.Info.ColorC = color; break;
}
this.DyeSuccess(creature);
Send.AcquireDyedItem(creature.Client, creature, creature.Temp.SkillItem1.Id, rndNr);
Send.DyeSkillComplete(creature.Client, creature, skillId, part, x, y);
return SkillResults.Okay;
}
示例2: Use
public override SkillResults Use(MabiCreature creature, MabiSkill skill, MabiPacket packet)
{
if (creature.Temp.SkillItem1 == null || creature.Temp.SkillItem2 == null)
return SkillResults.Failure;
var part = packet.GetInt();
// Regular
if (packet.GetElementType() == ElementType.Short)
{
var x = packet.GetShort();
var y = packet.GetShort();
Send.SkillUseDye(creature.Client, creature, skill.Id, part, x, y);
}
// Fixed
else if (packet.GetElementType() == ElementType.Byte)
{
var unk = packet.GetByte();
Send.SkillUseDye(creature.Client, creature, skill.Id, part, unk);
}
return SkillResults.Okay;
}