private void parseCPMMOItem(CPMMOItem cPMMOItem) { ActionedItem actionedItem = (ActionedItem)cPMMOItem; if (actionedItem.ActionCount > 0) { onPinataHit(cPMMOItem.Id.Id.ToString(), actionedItem.ActionCount); } }
public override IEnumerator Consume(int partialCount, string type, object properties) { base.type = type; if (partialCount > 0) { actionCount = partialCount; } else { actionCount = startingActionCount; } item = new ActionedItem(timeToLive, actionCount); item.Id = new CPMMOItemId(client.generateMMOItemId(), CPMMOItemId.CPMMOItemParent.WORLD); item.CreatorId = client.clubPenguinClient.PlayerSessionId; item.Type = type; ConsumableMMODeployedEvent data = default(ConsumableMMODeployedEvent); data.SessionId = client.clubPenguinClient.PlayerSessionId; data.ExperienceId = item.Id.Id; Vector3 vecPosition = Vector3.zero; if (properties is Vector3) { vecPosition = (Vector3)properties; } CPMMOItemPosition position = default(CPMMOItemPosition); position.Id = item.Id; position.Position = vecPosition; yield return(null); client.processEvent(GameServerEvent.CONSUMABLE_MMO_DEPLOYED, data); yield return(client.dequipeHeldObjectResult()); client.processEvent(GameServerEvent.SERVER_ITEM_ADDED, item); client.processEvent(GameServerEvent.SERVER_ITEM_MOVED, position); client.activeConsumables.Add(this); yield return(countDown()); }
private static ConsumableItem createConsumableItem(IMMOItem sfsItem) { string stringValue = sfsItem.GetVariable(SocketItemVars.TEMPLATE.GetKey()).GetStringValue(); ConsumableItem consumableItem; switch (stringValue) { case "timed": consumableItem = new TimedItem(sfsItem); break; case "actioned": consumableItem = new ActionedItem(sfsItem); break; default: consumableItem = new ConsumableItem(); Log.LogError(typeof(CPMMOItem), "Unknown consumable template: " + stringValue); break; } consumableItem.Type = sfsItem.GetVariable(SocketItemVars.TYPE.GetKey()).GetStringValue(); return(consumableItem); }