本文整理汇总了C#中MirGridType类的典型用法代码示例。如果您正苦于以下问题:C# MirGridType类的具体用法?C# MirGridType怎么用?C# MirGridType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MirGridType类属于命名空间,在下文中一共展示了MirGridType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItemCombined
//TOADD
//ItemSplit
//ItemMerge
public void ItemCombined(string source, UserItem fromItem, UserItem toItem, int slotFrom, int slotTo, MirGridType grid)
{
string task = string.Empty;
if (fromItem != null && toItem != null)
{
task = string.Format("Item Combined - {0} with {1} from {2} to {3} in {4} ({5})", fromItem.Info.Name, toItem.Info.Name, slotFrom, slotTo, grid, toItem.UniqueID);
}
Action action = new Action { Source = source, Task = task };
RecordAction(action);
}
示例2: ItemMoved
public void ItemMoved(string source, UserItem item, MirGridType from, MirGridType to, int slotFrom, int slotTo)
{
string task = string.Empty;
if (item != null)
{
task = string.Format("Item Moved - {0} from {1}:{2} to {3}:{4} ({5})", item.Info.Name, from, slotFrom, to, slotTo, item.UniqueID);
}
Action action = new Action { Source = source, Task = task };
RecordAction(action);
}
示例3: ReadPacket
protected override void ReadPacket(BinaryReader reader)
{
Grid = (MirGridType)reader.ReadByte();
UniqueID = reader.ReadUInt64();
To = reader.ReadInt32();
Success = reader.ReadBoolean();
}
示例4: ReadPacket
protected override void ReadPacket(BinaryReader reader)
{
Grid = (MirGridType)reader.ReadByte();
UniqueID = reader.ReadUInt64();
Count = reader.ReadUInt32();
}
示例5: EquipSlotItem
public void EquipSlotItem(MirGridType grid, ulong id, int to, MirGridType gridTo)
{
S.EquipSlotItem p = new S.EquipSlotItem { Grid = grid, UniqueID = id, To = to, GridTo = gridTo, Success = false };
UserItem Item = null;
switch (gridTo)
{
case MirGridType.Mount:
Item = Info.Equipment[(int)EquipmentSlot.Mount];
break;
case MirGridType.Fishing:
Item = Info.Equipment[(int)EquipmentSlot.Weapon];
break;
default:
Enqueue(p);
return;
}
if (Item == null || Item.Slots == null)
{
Enqueue(p);
return;
}
if (gridTo == MirGridType.Fishing && (Item.Info.Shape != 49 && Item.Info.Shape != 50))
{
Enqueue(p);
return;
}
if (to < 0 || to >= Item.Slots.Length)
{
Enqueue(p);
return;
}
if (Item.Slots[to] != null)
{
Enqueue(p);
return;
}
UserItem[] array;
switch (grid)
{
case MirGridType.Inventory:
array = Info.Inventory;
break;
case MirGridType.Storage:
if (NPCPage == null || !String.Equals(NPCPage.Key, NPCObject.StorageKey, StringComparison.CurrentCultureIgnoreCase))
{
Enqueue(p);
return;
}
NPCObject ob = null;
for (int i = 0; i < CurrentMap.NPCs.Count; i++)
{
if (CurrentMap.NPCs[i].ObjectID != NPCID) continue;
ob = CurrentMap.NPCs[i];
break;
}
if (ob == null || !Functions.InRange(ob.CurrentLocation, CurrentLocation, Globals.DataRange))
{
Enqueue(p);
return;
}
array = Account.Storage;
break;
default:
Enqueue(p);
return;
}
int index = -1;
UserItem temp = null;
for (int i = 0; i < array.Length; i++)
{
temp = array[i];
if (temp == null || temp.UniqueID != id) continue;
index = i;
break;
}
if (temp == null || index == -1)
{
Enqueue(p);
return;
}
if ((temp.SoulBoundId != -1) && (temp.SoulBoundId != Info.Index))
{
Enqueue(p);
return;
}
//.........这里部分代码省略.........
示例6: CanRemoveItem
private bool CanRemoveItem(MirGridType grid, UserItem item)
{
//Item Stuck
UserItem[] array;
switch (grid)
{
case MirGridType.Inventory:
array = Info.Inventory;
break;
case MirGridType.Storage:
array = Account.Storage;
break;
default:
return false;
}
if (RidingMount && item.Info.Type != ItemType.Torch)
{
return false;
}
return FreeSpace(array) > 0;
}
示例7: SplitItem
public void SplitItem(MirGridType grid, ulong id, uint count)
{
S.SplitItem1 p = new S.SplitItem1 { Grid = grid, UniqueID = id, Count = count, Success = false };
UserItem[] array;
switch (grid)
{
case MirGridType.Inventory:
array = Info.Inventory;
break;
case MirGridType.Storage:
if (NPCPage == null || !String.Equals(NPCPage.Key, NPCObject.StorageKey, StringComparison.CurrentCultureIgnoreCase))
{
Enqueue(p);
return;
}
NPCObject ob = null;
for (int i = 0; i < CurrentMap.NPCs.Count; i++)
{
if (CurrentMap.NPCs[i].ObjectID != NPCID) continue;
ob = CurrentMap.NPCs[i];
break;
}
if (ob == null || !Functions.InRange(ob.CurrentLocation, CurrentLocation, Globals.DataRange))
{
Enqueue(p);
return;
}
array = Account.Storage;
break;
default:
Enqueue(p);
return;
}
UserItem temp = null;
for (int i = 0; i < array.Length; i++)
{
if (array[i] == null || array[i].UniqueID != id) continue;
temp = array[i];
break;
}
if (temp == null || count >= temp.Count || FreeSpace(array) == 0)
{
Enqueue(p);
return;
}
temp.Count -= count;
temp = Envir.CreateFreshItem(temp.Info);
temp.Count = count;
p.Success = true;
Enqueue(p);
Enqueue(new S.SplitItem { Item = temp, Grid = grid });
if (grid == MirGridType.Inventory && (temp.Info.Type == ItemType.Potion || temp.Info.Type == ItemType.Scroll || temp.Info.Type == ItemType.Amulet))
{
if (temp.Info.Type == ItemType.Potion || temp.Info.Type == ItemType.Scroll)
{
for (int i = 0; i < 4; i++)
{
if (array[i] != null) continue;
array[i] = temp;
RefreshBagWeight();
return;
}
}
else if (temp.Info.Type == ItemType.Amulet)
{
for (int i = 4; i < 6; i++)
{
if (array[i] != null) continue;
array[i] = temp;
RefreshBagWeight();
return;
}
}
}
for (int i = 6; i < array.Length; i++)
{
if (array[i] != null) continue;
array[i] = temp;
RefreshBagWeight();
return;
}
}
示例8: EquipItem
public void EquipItem(MirGridType grid, ulong id, int to)
{
S.EquipItem p = new S.EquipItem { Grid = grid, UniqueID = id, To = to, Success = false };
if (Fishing)
{
Enqueue(p);
return;
}
if (to < 0 || to >= Info.Equipment.Length)
{
Enqueue(p);
return;
}
UserItem[] array;
switch (grid)
{
case MirGridType.Inventory:
array = Info.Inventory;
break;
case MirGridType.Storage:
if (NPCPage == null || !String.Equals(NPCPage.Key, NPCObject.StorageKey, StringComparison.CurrentCultureIgnoreCase))
{
Enqueue(p);
return;
}
NPCObject ob = null;
for (int i = 0; i < CurrentMap.NPCs.Count; i++)
{
if (CurrentMap.NPCs[i].ObjectID != NPCID) continue;
ob = CurrentMap.NPCs[i];
break;
}
if (ob == null || !Functions.InRange(ob.CurrentLocation, CurrentLocation, Globals.DataRange))
{
Enqueue(p);
return;
}
array = Account.Storage;
break;
default:
Enqueue(p);
return;
}
int index = -1;
UserItem temp = null;
for (int i = 0; i < array.Length; i++)
{
temp = array[i];
if (temp == null || temp.UniqueID != id) continue;
index = i;
break;
}
if (temp == null || index == -1)
{
Enqueue(p);
return;
}
if ((Info.Equipment[to] != null) && (Info.Equipment[to].Cursed) && (!UnlockCurse))
{
Enqueue(p);
return;
}
if ((temp.SoulBoundId != -1) && (temp.SoulBoundId != Info.Index))
{
Enqueue(p);
return;
}
if (Info.Equipment[to] != null)
if (Info.Equipment[to].WeddingRing != -1)
{
Enqueue(p);
return;
}
if (CanEquipItem(temp, to))
{
if (temp.Info.NeedIdentify && !temp.Identified)
{
temp.Identified = true;
Enqueue(new S.RefreshItem { Item = temp });
}
if ((temp.Info.Bind.HasFlag(BindMode.BindOnEquip)) && (temp.SoulBoundId == -1))
{
temp.SoulBoundId = Info.Index;
Enqueue(new S.RefreshItem { Item = temp });
}
if ((Info.Equipment[to] != null) && (Info.Equipment[to].Cursed) && (UnlockCurse))
UnlockCurse = false;
//.........这里部分代码省略.........
示例9: MoveItem
public void MoveItem(MirGridType grid, int from, int to)
{
S.MoveItem p = new S.MoveItem { Grid = grid, From = from, To = to, Success = false };
UserItem[] array;
switch (grid)
{
case MirGridType.Inventory:
array = Info.Inventory;
break;
case MirGridType.Storage:
if (NPCPage == null || !String.Equals(NPCPage.Key, NPCObject.StorageKey, StringComparison.CurrentCultureIgnoreCase))
{
Enqueue(p);
return;
}
NPCObject ob = null;
for (int i = 0; i < CurrentMap.NPCs.Count; i++)
{
if (CurrentMap.NPCs[i].ObjectID != NPCID) continue;
ob = CurrentMap.NPCs[i];
break;
}
if (ob == null || !Functions.InRange(ob.CurrentLocation, CurrentLocation, Globals.DataRange))
{
Enqueue(p);
return;
}
array = Account.Storage;
break;
case MirGridType.Trade:
array = Info.Trade;
TradeItem();
break;
case MirGridType.Refine:
array = Info.Refine;
break;
default:
Enqueue(p);
return;
}
if (from >= 0 && to >= 0 && from < array.Length && to < array.Length)
{
if (array[from] == null)
{
Report.ItemError("MoveItem", grid, grid, from, to);
ReceiveChat("Item Move Error - Please report the item you tried to move and the time", ChatType.System);
Enqueue(p);
return;
}
UserItem i = array[to];
array[to] = array[from];
Report.ItemMoved("MoveItem", array[to], grid, grid, from, to);
array[from] = i;
Report.ItemMoved("MoveItem", array[from], grid, grid, to, from);
p.Success = true;
Enqueue(p);
return;
}
Enqueue(p);
}
示例10: RemoveSlotItem
public void RemoveSlotItem(MirGridType grid, ulong id, int to, MirGridType gridTo)
{
S.RemoveSlotItem p = new S.RemoveSlotItem { Grid = grid, UniqueID = id, To = to, GridTo = gridTo, Success = false };
UserItem[] array;
switch (gridTo)
{
case MirGridType.Inventory:
array = Info.Inventory;
break;
case MirGridType.Storage:
if (NPCPage == null || !String.Equals(NPCPage.Key, NPCObject.StorageKey, StringComparison.CurrentCultureIgnoreCase))
{
Enqueue(p);
return;
}
NPCObject ob = null;
for (int i = 0; i < CurrentMap.NPCs.Count; i++)
{
if (CurrentMap.NPCs[i].ObjectID != NPCID) continue;
ob = CurrentMap.NPCs[i];
break;
}
if (ob == null || !Functions.InRange(ob.CurrentLocation, CurrentLocation, Globals.DataRange))
{
Enqueue(p);
return;
}
array = Account.Storage;
break;
default:
Enqueue(p);
return;
}
if (to < 0 || to >= array.Length) return;
UserItem temp = null;
UserItem slotTemp = null;
int index = -1;
switch (grid)
{
case MirGridType.Mount:
temp = Info.Equipment[(int)EquipmentSlot.Mount];
break;
case MirGridType.Fishing:
temp = Info.Equipment[(int)EquipmentSlot.Weapon];
break;
default:
Enqueue(p);
return;
}
if (temp == null || temp.Slots == null)
{
Enqueue(p);
return;
}
if (grid == MirGridType.Fishing && (temp.Info.Shape != 49 && temp.Info.Shape != 50))
{
Enqueue(p);
return;
}
for (int i = 0; i < temp.Slots.Length; i++)
{
slotTemp = temp.Slots[i];
if (slotTemp == null || slotTemp.UniqueID != id) continue;
index = i;
break;
}
if (slotTemp == null || index == -1)
{
Enqueue(p);
return;
}
if (slotTemp.Cursed && !UnlockCurse)
{
Enqueue(p);
return;
}
if (slotTemp.WeddingRing != -1)
{
Enqueue(p);
return;
}
if (!CanRemoveItem(gridTo, slotTemp)) return;
temp.Slots[index] = null;
if (slotTemp.Cursed)
UnlockCurse = false;
if (array[to] == null)
//.........这里部分代码省略.........
示例11: RemoveItem
public void RemoveItem(MirGridType grid, ulong id, int to)
{
S.RemoveItem p = new S.RemoveItem { Grid = grid, UniqueID = id, To = to, Success = false };
UserItem[] array;
switch (grid)
{
case MirGridType.Inventory:
array = Info.Inventory;
break;
case MirGridType.Storage:
if (NPCPage == null || !String.Equals(NPCPage.Key, NPCObject.StorageKey, StringComparison.CurrentCultureIgnoreCase))
{
Enqueue(p);
return;
}
NPCObject ob = null;
for (int i = 0; i < CurrentMap.NPCs.Count; i++)
{
if (CurrentMap.NPCs[i].ObjectID != NPCID) continue;
ob = CurrentMap.NPCs[i];
break;
}
if (ob == null || !Functions.InRange(ob.CurrentLocation, CurrentLocation, Globals.DataRange))
{
Enqueue(p);
return;
}
array = Account.Storage;
break;
default:
Enqueue(p);
return;
}
if (to < 0 || to >= array.Length) return;
UserItem temp = null;
int index = -1;
for (int i = 0; i < Info.Equipment.Length; i++)
{
temp = Info.Equipment[i];
if (temp == null || temp.UniqueID != id) continue;
index = i;
break;
}
if (temp == null || index == -1)
{
Enqueue(p);
return;
}
if (temp.Cursed && !UnlockCurse)
{
Enqueue(p);
return;
}
if (!CanRemoveItem(grid, temp)) return;
Info.Equipment[index] = null;
if (temp.Cursed)
UnlockCurse = false;
if (array[to] == null)
{
array[to] = temp;
p.Success = true;
Enqueue(p);
RefreshStats();
Broadcast(GetUpdateInfo());
return;
}
Enqueue(p);
}
示例12: MoveItem
public void MoveItem(MirGridType grid, int from, int to)
{
S.MoveItem p = new S.MoveItem { Grid = grid, From = from, To = to, Success = false };
UserItem[] array;
switch (grid)
{
case MirGridType.Inventory:
array = Info.Inventory;
break;
case MirGridType.Storage:
if (NPCPage == null || !String.Equals(NPCPage.Key, NPCObject.StorageKey, StringComparison.CurrentCultureIgnoreCase))
{
Enqueue(p);
return;
}
NPCObject ob = null;
for (int i = 0; i < CurrentMap.NPCs.Count; i++)
{
if (CurrentMap.NPCs[i].ObjectID != NPCID) continue;
ob = CurrentMap.NPCs[i];
break;
}
if (ob == null || !Functions.InRange(ob.CurrentLocation, CurrentLocation, Globals.DataRange))
{
Enqueue(p);
return;
}
array = Account.Storage;
break;
default:
Enqueue(p);
return;
}
if (from >= 0 && to >= 0 && from < array.Length && to < array.Length)
{
UserItem i = array[to];
array[to] = array[from];
array[from] = i;
p.Success = true;
Enqueue(p);
return;
}
Enqueue(p);
}
示例13: EquipItem
public void EquipItem(MirGridType grid, ulong id, int to)
{
S.EquipItem p = new S.EquipItem { Grid = grid, UniqueID = id, To = to, Success = false };
if (to < 0 || to >= Info.Equipment.Length)
{
Enqueue(p);
return;
}
UserItem[] array;
switch (grid)
{
case MirGridType.Inventory:
array = Info.Inventory;
break;
case MirGridType.Storage:
if (NPCPage == null || NPCPage.Key != NPCObject.StorageKey)
{
Enqueue(p);
return;
}
NPCObject ob = null;
for (int i = 0; i < CurrentMap.NPCs.Count; i++)
{
if (CurrentMap.NPCs[i].ObjectID != NPCID) continue;
ob = CurrentMap.NPCs[i];
break;
}
if (ob == null || !Functions.InRange(ob.CurrentLocation, CurrentLocation, Globals.DataRange))
{
Enqueue(p);
return;
}
array = Account.Storage;
break;
default:
Enqueue(p);
return;
}
int index = -1;
UserItem temp = null;
for (int i = 0; i < array.Length; i++)
{
temp = array[i];
if (temp == null || temp.UniqueID != id) continue;
index = i;
break;
}
if (temp == null || index == -1)
{
Enqueue(p);
return;
}
if (CanEquipItem(temp, to))
{
array[index] = Info.Equipment[to];
Info.Equipment[to] = temp;
p.Success = true;
Enqueue(p);
RefreshStats();
Broadcast(GetUpdateInfo());
return;
}
Enqueue(p);
}
示例14: ItemError
public void ItemError(string source, MirGridType from, MirGridType to, int slotFrom, int slotTo)
{
string task = string.Empty;
task = string.Format("Item Moved Error - from {0}:{1} to {2}:{3}", from, slotFrom, to, slotTo);
Action action = new Action { Source = source, Task = task };
RecordAction(action);
}
示例15: MergeItem
public void MergeItem(MirGridType gridFrom, MirGridType gridTo, ulong fromID, ulong toID)
{
S.MergeItem p = new S.MergeItem { GridFrom = gridFrom, GridTo = gridTo, IDFrom = fromID, IDTo = toID, Success = false };
UserItem[] arrayFrom;
switch (gridFrom)
{
case MirGridType.Inventory:
arrayFrom = Info.Inventory;
break;
case MirGridType.Storage:
if (NPCPage == null || !String.Equals(NPCPage.Key, NPCObject.StorageKey, StringComparison.CurrentCultureIgnoreCase))
{
Enqueue(p);
return;
}
NPCObject ob = null;
for (int i = 0; i < CurrentMap.NPCs.Count; i++)
{
if (CurrentMap.NPCs[i].ObjectID != NPCID) continue;
ob = CurrentMap.NPCs[i];
break;
}
if (ob == null || !Functions.InRange(ob.CurrentLocation, CurrentLocation, Globals.DataRange))
{
Enqueue(p);
return;
}
arrayFrom = Account.Storage;
break;
case MirGridType.Equipment:
arrayFrom = Info.Equipment;
break;
case MirGridType.Fishing:
if (Info.Equipment[(int)EquipmentSlot.Weapon] == null || (Info.Equipment[(int)EquipmentSlot.Weapon].Info.Shape != 49 && Info.Equipment[(int)EquipmentSlot.Weapon].Info.Shape != 50))
{
Enqueue(p);
return;
}
arrayFrom = Info.Equipment[(int)EquipmentSlot.Weapon].Slots;
break;
default:
Enqueue(p);
return;
}
UserItem[] arrayTo;
switch (gridTo)
{
case MirGridType.Inventory:
arrayTo = Info.Inventory;
break;
case MirGridType.Storage:
if (NPCPage == null || !String.Equals(NPCPage.Key, NPCObject.StorageKey, StringComparison.CurrentCultureIgnoreCase))
{
Enqueue(p);
return;
}
NPCObject ob = null;
for (int i = 0; i < CurrentMap.NPCs.Count; i++)
{
if (CurrentMap.NPCs[i].ObjectID != NPCID) continue;
ob = CurrentMap.NPCs[i];
break;
}
if (ob == null || !Functions.InRange(ob.CurrentLocation, CurrentLocation, Globals.DataRange))
{
Enqueue(p);
return;
}
arrayTo = Account.Storage;
break;
case MirGridType.Equipment:
arrayTo = Info.Equipment;
break;
case MirGridType.Fishing:
if (Info.Equipment[(int)EquipmentSlot.Weapon] == null || (Info.Equipment[(int)EquipmentSlot.Weapon].Info.Shape != 49 && Info.Equipment[(int)EquipmentSlot.Weapon].Info.Shape != 50))
{
Enqueue(p);
return;
}
arrayTo = Info.Equipment[(int)EquipmentSlot.Weapon].Slots;
break;
default:
Enqueue(p);
return;
}
UserItem tempFrom = null;
int index = -1;
for (int i = 0; i < arrayFrom.Length; i++)
{
if (arrayFrom[i] == null || arrayFrom[i].UniqueID != fromID) continue;
index = i;
tempFrom = arrayFrom[i];
break;
//.........这里部分代码省略.........