[WIP] Emulations .NET menu

Shout-Out

User Tag List

Results 1 to 7 of 7
  1. #1
    Cromon's Avatar Legendary


    Reputation
    840
    Join Date
    Mar 2008
    Posts
    714
    Thanks G/R
    0/7
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [WIP] Emulations .NET

    Hello everybody!

    Because a lot of people like .NET languages more then native C++ or LUA ive decided to create a wrapper for scripting in .NET languages. It allows you to create DLLs in managed languages with scripts that get called from the core. It is planed to write a wrapper with identical functions for arcemu, mangos/trinity. So basically scripts written in .NET will be available for every emulation without changes.

    This is still a WIP but here is a little example which shows you some of the functions ive implemented yet:
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using WoW;
    
    namespace Wrapper
    {
        public class ScriptProvider : IScriptProvider
        {
            public ScriptProvider()
            {
            }
    
            public void InitLib(ScriptMgr init)
            {
                init.RegisterChatHook(new Scripting.ChatHook());
                init.RegisterCreatureAI(100, new Scripting.GnollScript());
                init.RegisterCreatureGossip(50000, new Scripting.TestGossip());
            }
        }
    }
    
    namespace Scripting
    {
        public class ChatHook : IOnChatHook
        {
            public void Execute(Player sender, string message)
            {
                uint newLevel = 0;
                if (uint.TryParse(message, out newLevel))
                {
                    uint level = sender.GetUInt32Value(UnitFields.UNIT_FIELD_LEVEL);
                    sender.SetUInt32Value(UnitFields.UNIT_FIELD_LEVEL, level + newLevel);
                    sender.BroadcastMessage("Increased your level by " + newLevel);
                }
    
            }
        }
    
        public class TestGossip : IGossipScript
        {
            public override bool OnConstructMenu(Unit sender, Player target, GossipMenu menu)
            {
                if (!target.HasGMPermission())
                    return false;
    
                ItemClickDlg Item3Click = delegate(Unit send, Player tar)
                {
                    Console.WriteLine("Player '" + tar.GetName() + "' has clicked the third item!");
                    return true;
                };
    
                menu.AddItem(1, "Menu 1", Item1Click);
                menu.AddItem(2, "Menu 2", Item2Click);
                menu.AddItem(3, "Menu 3", Item3Click);
    
                menu.SetTextID(197);
                return true;
            }
    
            public bool Item2Click(Unit sender, Player target)
            {
                if (sender is Creature)
                {
                    Creature cr = (Creature)sender;
                    cr.SendChatMessage("You have clicked the second item!");
                }
                return true;
            }
    
            public bool Item1Click(Unit sender, Player target)
            {
                target.BroadcastMessage("Clicked the first item!");
                target.AddItem(39267, 1);
                target.AddSpell(28132);
                target.IncreaseAllSkills(400);
                if (!target.HasQuestFinished(10000))
                    target.SendNotification("You have to finish the quest 10000 first!");
                else
                    target.TeleportTo(609, 100.0f, 200.0f, 300.0f);
                return true;
            }
    
        }
    
        public class GnollScript : ICreatureAI
        {
            public override void OnCombatStart(Unit attacker)
            {
                if (attacker is Player)
                {
                    Vector pos = attacker.GetPosition();
                    string msg = "Combat started by '" + ((Player)attacker).GetName() + "' ";
                    msg += "at position (" + pos.x + "/" + pos.y + "/" + pos.z + ")!";
                    ((Player)attacker).BroadcastMessage(msg);
                }
                else
                    Console.WriteLine("Combat was not started by a player!");
            }
        }
    }
    So what do you tink about that? Sounds this good or not?

    Greetings
    Cromon

    [WIP] Emulations .NET
  2. #2
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Scripts accessable by all emulators does indeed sound good, but whether people will want to use it over C++ or Lua is another matter.

  3. #3
    2dgreengiant's Avatar ★ Elder ★


    Reputation
    1192
    Join Date
    Feb 2007
    Posts
    7,129
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    Scripts accessable by all emulators does indeed sound good, but whether people will want to use it over C++ or Lua is another matter.
    Would make the mangoz users more happy as alot of scripts are done for ascent based.
    If you need me you have my skype, if you don't have my skype then you don't need me.

  4. #4
    Cromon's Avatar Legendary


    Reputation
    840
    Join Date
    Mar 2008
    Posts
    714
    Thanks G/R
    0/7
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    C++ is still possible and LUA... well ... is neglectable :P

  5. #5
    wowsc4p3's Avatar Active Member
    Reputation
    59
    Join Date
    Nov 2007
    Posts
    380
    Thanks G/R
    0/2
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    C++ is .net language?

  6. #6
    Cromon's Avatar Legendary


    Reputation
    840
    Join Date
    Mar 2008
    Posts
    714
    Thanks G/R
    0/7
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    C++/CLI – Wikipedia

    It now also supports an arbitrary amount of AIUpdate-functions as you can see here:
    Code:
        public class FireWork : ICreatureAI
        {
            public override void OnLoad()
            {
                StartAIUpdate(1500, Firework1);
                StartAIUpdate(1250, Firework2);
            }
    
            public void Firework2()
            {
                if (_unit != null)
                    _unit.CastSpell(11544, _unit, true);
            }
    
            public void Firework1()
            {
                if (_unit != null)
                    _unit.CastSpell(11352, _unit, true);
            }
        }

  7. #7
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The CLI attack is above us! Hurry to get down into the bunkers you Linux users out there who still fights for Linux and tries to get Microsofts attempt to take over the programmers world!
    I found this among my fathers old documents, he wrote it ironically before he learnt C#.

    I myself thinks the CLI creates a good opportunity, unfortunately it doesn't support Linux.

    I think interopability is one of the many good ways CLI makes the world of programming better in the Windows environment.
    (no idea if Interopability is the right word to put there :S)

    If you succeed upon writing a plugin system that enables CLI and import the plugin CLI Dll's into ArcEmu, I'd be astonished.
    (Although it isn't hard to launch a CLI Dll from C++ using the CLI API)


    I wish you Good Luck and I really hope you take this project further!
    Why do I need a signature?

Similar Threads

  1. [Misc] Any VB.net emulators left?
    By Ithinktheyhavehax in forum WoW EMU Questions & Requests
    Replies: 14
    Last Post: 04-02-2013, 07:33 AM
  2. Private.NET - Starcraft II Battle.NET 2.0 Emulator
    By KratoZz in forum MMO Exploits|Hacks
    Replies: 7
    Last Post: 02-02-2011, 07:27 AM
  3. Replies: 2
    Last Post: 03-05-2009, 05:16 AM
  4. WowwoW Emulator - Help
    By Muryllis in forum World of Warcraft General
    Replies: 2
    Last Post: 06-24-2006, 08:12 PM
All times are GMT -5. The time now is 05:57 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search