//public override void TstColWithName(SkExternalFuncPara para) //{ // //base.TstColWithName(para); //} protected override void OnPutInPak(List <ItemToPack> itemsToPack) { base.OnPutInPak(itemsToPack); if (Entity.packageCmpt != null) { foreach (ItemToPack item in itemsToPack) { if (PeGameMgr.IsMulti) { if (_net != null) { _net.RPCServer(EPacketType.PT_Test_AddItem, item._id, item._cnt); } } else { NpcPackageCmpt npcpk = Entity.packageCmpt as NpcPackageCmpt; if (npcpk != null) { npcpk.AddToHandin(item._id, item._cnt); } else { Entity.packageCmpt.Add(item._id, item._cnt); } } } } }
public bool ReviveServent(bool usePlayer = true) { NpcPackageCmpt Serventpackage = this.GetComponent <NpcPackageCmpt>(); if (Serventpackage == null) { return(false); } ItemAsset.SlotList package = Serventpackage.GetSlotList(); ItemAsset.ItemObject Obj = package.FindItemByProtoId(ReviveItemProtoId); if (null == Obj) { package = Serventpackage.GetHandinList(); Obj = package.FindItemByProtoId(ReviveItemProtoId); } if (Obj == null && !usePlayer) { return(false); } if (Obj == null) { if (GameUI.Instance.mMainPlayer == null) { return(false); } PlayerPackageCmpt playerPackage = GameUI.Instance.mMainPlayer.GetCmpt <PlayerPackageCmpt>(); if (playerPackage == null) { return(false); } ItemAsset.ItemObject Obj2 = playerPackage.package.FindItemByProtoId(ReviveItemProtoId); if (Obj2 == null) { return(false); } return(Use(Obj2, playerPackage)); //return false ; } return(Use(Obj)); }
public bool NpcCanFetchAll(Pathea.NpcPackageCmpt npcPackage) { List <MaterialItem> items = new List <MaterialItem>(); foreach (IDroppableItemList dropItems in _itemLists) { int n = dropItems.DroppableItemCount; for (int i = 0; i < n; i++) { ItemSample item = dropItems.GetDroppableItemAt(i); items.Add(new MaterialItem() { protoId = item.protoId, count = item.stackCount }); } } return(npcPackage.CanAddItemList(items)); }
public void NpcFetchAll(Pathea.NpcPackageCmpt npcPackage) { List <MaterialItem> items = new List <MaterialItem>(); foreach (IDroppableItemList dropItems in _itemLists) { int n = dropItems.DroppableItemCount; for (int i = 0; i < n; i++) { ItemSample item = dropItems.GetDroppableItemAt(i); items.Add(new MaterialItem() { protoId = item.protoId, count = item.stackCount }); } } if (!npcPackage.CanAddItemList(items)) { return; } foreach (MaterialItem item in items) { npcPackage.Add(item.protoId, item.count); } foreach (IDroppableItemList itemDrop in _itemLists) { itemDrop.RemoveDroppableItemAll(); } if (_skAlive != null && GetCount() == 0) { PeEventGlobal.Instance.PickupEvent.Invoke(_skAlive); } }