コード例 #1
0
ファイル: NpcInteraction.cs プロジェクト: clock2255/awagas
 // Update is called once per frame
 void Update()
 {
     if (NpcId != null && ClientAPI.GetObjectNode(NpcId.ToLong()) != null)
     {
         if (Vector3.Distance(ClientAPI.GetPlayerObject().Position, ClientAPI.GetObjectNode(NpcId.ToLong()).GameObject.transform.position) > 5)
         {
             NpcId = null;
             string[] args = new string[1];
             AtavismEventSystem.DispatchEvent("CLOSE_NPC_DIALOGUE", args);
         }
     }
 }
コード例 #2
0
        public void HandleTradeRequest(Dictionary <string, object> props)
        {
            myOffers.Clear();
            for (int i = 0; i < tradeSlotCount; i++)
            {
                myOffers.Add(null);
            }
            theirOffers.Clear();
            for (int i = 0; i < tradeSlotCount; i++)
            {
                theirOffers.Add(null);
            }
            acceptedByMe      = false;
            acceptedByPartner = false;
            cancelled         = false;

            tradePartnerOid = (OID)props["requesterOid"];
            long partnerOid = tradePartnerOid.ToLong();
            int  count      = (int)props["tradeInviteTimeout"];

            myCurrencyOffers.Clear();

            theirCurrencyOffers.Clear();
            // dispatch a ui event to tell the rest of the system
#if AT_I2LOC_PRESET
            UGUIConfirmationPanel.Instance.ShowConfirmationBox(ClientAPI.GetObjectNode(partnerOid).Name + " " + I2.Loc.LocalizationManager.GetTranslation("has invited you to trade"), tradePartnerOid, TradeInviteResponse, count);
#else
            UGUIConfirmationPanel.Instance.ShowConfirmationBox(ClientAPI.GetObjectNode(partnerOid).Name + " has invited you to trade", tradePartnerOid, TradeInviteResponse, count);
#endif
        }
コード例 #3
0
ファイル: NpcInteraction.cs プロジェクト: clock2255/awagas
 public virtual void StartInteraction()
 {
     if (interactionType == "Bank")
     {
         Inventory.Instance.RequestBankInfo();
     }
     else
     {
         NetworkAPI.SendTargetedCommand(npcId.ToLong(), "/startInteraction " + interactionID + " "
                                        + interactionType);
     }
 }
コード例 #4
0
 void Update()
 {
     if (tradePartnerOid != null)
     {
         if (ClientAPI.GetPlayerObject() != null && ClientAPI.GetObjectNode(tradePartnerOid.ToLong()) != null)
         {
             if (Vector3.Distance(ClientAPI.GetPlayerObject().Position, ClientAPI.GetObjectNode(tradePartnerOid.ToLong()).Position) > interactionDistance)
             {
                 CancelTrade();
             }
         }
     }
 }
コード例 #5
0
        public void HandleCombatEvent(Dictionary <string, object> props)
        {
            string eventType = (string)props["event"];
            OID    caster    = (OID)props["caster"];
            OID    target    = (OID)props["target"];
            int    abilityID = (int)props["abilityID"];
            int    effectID  = (int)props["effectID"];
            string value1    = "" + (int)props["value1"];
            string value2    = "" + (int)props["value2"];
            string value3    = (string)props["value3"];
            string value4    = (string)props["value4"];

            // Debug.LogWarning("Got Combat Event " + eventType);
//             Debug.LogError("HandleCombatEvent " + caster + " | " + target + " | " + abilityID + " | " + effectID + " | " + value1 + " | " + value2+" | "+ eventType);
            //Automatical select attacer
            try
            {
                if (target.ToLong() == ClientAPI.GetPlayerOid() && target != caster &&
                    (ClientAPI.GetTargetObject() == null || (ClientAPI.GetTargetObject() != null && ClientAPI.GetTargetObject().PropertyExists("health") && (int)ClientAPI.GetTargetObject().GetProperty("health") == 0)))
                {
                    ClientAPI.SetTarget(caster.ToLong());
                }
            }
            catch (System.Exception e)
            {
                Debug.LogError("Exception e=" + e);
            }
            // ClientAPI.Write("Got Combat Event: " + eventType);
            //   int messageType = 2;

            if (eventType == "CombatPhysicalDamage")
            {
                //		messageType = 1;
            }
            else if (eventType == "CombatMagicalDamage")
            {
            }
            else if (eventType == "CombatPhysicalCritical")
            {
                ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Critic");

                //		messageType = 1;
            }
            else if (eventType == "CombatMagicalCritical")
            {
                ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Critic");
                //		messageType = 1;
            }
            else if (eventType == "CombatMissed")
            {
                ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Evaded");

#if AT_I2LOC_PRESET
                if (target.ToLong() == ClientAPI.GetPlayerOid())
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("MissedSelf");
                }
                else
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("Missed");
                }
#else
                value1 = "Missed";
#endif
            }
            else if (eventType == "CombatDodged")
            {
                ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Dodged");

#if AT_I2LOC_PRESET
                if (target.ToLong() == ClientAPI.GetPlayerOid())
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("DodgedSelf");
                }
                else
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("Dodged");
                }
#else
                value1 = "Dodged";
#endif
            }
            else if (eventType == "CombatBlocked")
            {
                ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Blocked");
#if AT_I2LOC_PRESET
                if (target.ToLong() == ClientAPI.GetPlayerOid())
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("BlockedSelf");
                }
                else
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("Blocked");
                }
#else
                value1 = "Blocked";
#endif
            }
            else if (eventType == "CombatParried")
            {
                ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Parried");
                #if AT_I2LOC_PRESET
                if (target.ToLong() == ClientAPI.GetPlayerOid())
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("ParriedSelf");
                }
                else
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("Parried");
                }
#else
                value1 = "Parried";
#endif
            }
            else if (eventType == "CombatEvaded")
            {
                ClientAPI.GetObjectNode(target.ToLong()).MobController.PlayAnimationTrigger("Evaded");

#if AT_I2LOC_PRESET
                if (target.ToLong() == ClientAPI.GetPlayerOid())
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("EvadedSelf");
                }
                else
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("Evaded");
                }
#else
                value1 = "Evaded";
#endif
            }
            else if (eventType == "CombatImmune")
            {
#if AT_I2LOC_PRESET
                if (target.ToLong() == ClientAPI.GetPlayerOid())
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("ImmuneSelf");
                }
                else
                {
                    value1 = I2.Loc.LocalizationManager.GetTranslation("Immune");
                }
#else
                value1 = "Immune";
#endif
            }
            else if (eventType == "CombatBuffGained" || eventType == "CombatDebuffGained")
            {
                AtavismEffect e = Abilities.Instance.GetEffect(effectID);
                if (e != null)
                {
#if AT_I2LOC_PRESET
                    value1 = I2.Loc.LocalizationManager.GetTranslation("Ability/" + e.name);
#else
                    value1 = e.name;
#endif
                }
                else
                {
                    value1 = "";
                }
            }
            else if (eventType == "CombatBuffLost" || eventType == "CombatDebuffLost")
            {
                AtavismEffect e = Abilities.Instance.GetEffect(effectID);
                if (e != null)
                {
#if AT_I2LOC_PRESET
                    value1 = I2.Loc.LocalizationManager.GetTranslation("Effects/" + e.name);
#else
                    value1 = e.name;
#endif
                }
                else
                {
                    value1 = "";
                }
            }
            else if (eventType == "CastingStarted")
            {
                if (int.Parse(value1) > 0)
                {
                    string[] csArgs = new string[2];
                    csArgs[0] = value1;
                    csArgs[1] = caster.ToString();
                    AtavismEventSystem.DispatchEvent("CASTING_STARTED", csArgs);
                }
                return;
            }
            else if (eventType == "CastingCancelled")
            {
                //    Debug.LogError("CastingCancelled 1");
                string[] ccArgs = new string[2];
                ccArgs[0] = abilityID.ToString();
                ccArgs[1] = caster.ToString();
                AtavismEventSystem.DispatchEvent("CASTING_CANCELLED", ccArgs);
                //   Debug.LogError("CastingCancelled 2");
                return;
            }
            // dispatch a ui event to tell the rest of the system
            try
            {
                string[] args = new string[9];
                args[0] = eventType;
                args[1] = caster.ToString();
                args[2] = target.ToString();
                args[3] = value1;
                args[4] = value2;
                args[5] = abilityID.ToString();
                args[6] = effectID.ToString();
                args[7] = value3;
                args[8] = value4;
                AtavismEventSystem.DispatchEvent("COMBAT_EVENT", args);
            }
            catch (System.Exception e)
            {
                Debug.LogError("COMBAT_EVENT Exception:" + e);
            }



            //ClientAPI.GetObjectNode(target.ToLong()).GameObject.GetComponent<MobController3D>().GotDamageMessage(messageType, value1);
        }
コード例 #6
0
ファイル: NpcInteraction.cs プロジェクト: zukeru/ageofasura
 public void DoDialogueAction(int dialogueID, OID npcId)
 {
     NetworkAPI.SendTargetedCommand (npcId.ToLong(), "/dialogueOption " + dialogueID + " "
                                     + actionType + " " + actionID);
 }
コード例 #7
0
ファイル: Quests.cs プロジェクト: clock2255/awagas
 public void AcceptQuest(int questPos)
 {
     NetworkAPI.SendQuestResponseMessage(npcID.ToLong(), questsOffered[questPos].QuestId.ToLong(), true);
 }
コード例 #8
0
ファイル: AtavismMobName.cs プロジェクト: clock2255/awagas
        void UpdateNameDisplay(bool showName)
        {
            if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.Equals(ClientAPI.Instance.characterSceneName))
            {
                return;
            }
            string ownerName = "";

            if (node != null)
            {
                if (node.PropertyExists("nameDisplay") && !node.CheckBooleanProperty("nameDisplay"))
                {
                    showName = false;
                }
                if (node.PropertyExists("pet") && node.CheckBooleanProperty("pet"))
                {
                    if (node.PropertyExists("petOwner"))
                    {
                        OID owner = (OID)node.GetProperty("petOwner");
                        ownerName = " (" + ClientAPI.GetObjectNode(owner.ToLong()).Name + ")";
                    }
                }
            }
            string text = "";

            if (showName && node != null)
            {
                // Display a mobs SubTile if one is set in Mob Editor plugin.
                string SubTitle = "";
                if (node.PropertyExists("subTitle"))
                {
                    SubTitle = (string)node.GetProperty("subTitle");
                }
                if (SubTitle != null && SubTitle != "")
                {
                    SubTitle = "\n<" + SubTitle + ">";
                }
                string title = "";
                if (showTitle)
                {
                    if (node.PropertyExists("title"))
                    {
                        title = (string)node.GetProperty("title");
                    }
                    if (title != null && title != "")
                    {
                        title = "\n<" + title + ">";
                    }
                }
                string species = "";
                if (node.PropertyExists("species"))
                {
                    species = (string)node.GetProperty("species");
                }
                if (species != null && species != "")
                {
                    species = "\n" + species + "";
                }
                // Display GuildName
                string guildName = "";
                if (node.PropertyExists("guildName"))
                {
                    guildName = (string)node.GetProperty("guildName");
                }
                if (guildName != null && guildName != "")
                {
                    guildName = "\n<" + guildName + ">";
                }

                text = "<#ffff00>";
                if (node.PropertyExists("reaction"))
                {
                    int targetType = (int)node.GetProperty("reaction");
                    if (node.PropertyExists("aggressive"))
                    {
                        if ((bool)node.GetProperty("aggressive"))
                        {
                            targetType = -1;
                        }
                    }
                    if (targetType < 0)
                    {
                        text = "<#ff0000>";
                    }
                    else if (targetType > 0)
                    {
                        text = "<#00ff00>";
                    }
                }

                if (nameOnSelf && node != null && node.Oid.Equals(ClientAPI.GetPlayerOid()))
                {
                    text = "<#00ff00>";
                }
                text = text + mName + ownerName + "</color>" + SubTitle + title + guildName;
                if (mobName != null && node.PropertyExists("reaction"))
                {
                    mobName.GetComponent <TextMeshPro>().text = text;
                }
            }
            else
            {
                text = "<#00ff00>" + textfield + "</color>";
            }

            if (nameOnSelf || node != null && !node.Oid.Equals(ClientAPI.GetPlayerOid()))
            {
                if (mobName != null && mobName.GetComponent <TextMeshPro>() != null)
                {
                    mobName.GetComponent <TextMeshPro>().text = text;
                }
            }
            else
            {
                if (mobName != null && mobName.GetComponent <TextMeshPro>() != null)
                {
                    mobName.GetComponent <TextMeshPro>().text = "";
                }
            }
        }