示例#1
0
        private void Plugin_ChatBoxMessage(object sender, Decal.Adapter.ChatTextInterceptEventArgs e)
        {
            try {

                if (mCharconfig != null) {
                    string msg = e.ToString().Substring(1,e.ToString().Length -1);
                    //strip linefeed
                    int pos = 0;

                    switch (e.Color) {
                        case 0:
                        case 24:

                            if (msg.EndsWith("This permission will last one hour.")) {
                                pos = msg.IndexOf(" has given you permission to loot");
                                if (pos >= 0) {
                                    string playercorpse = "Corpse of " + msg.Substring(0, pos);

                                    if (!mProtectedCorpses.Contains(playercorpse)) {
                                        wtcw("Alinco added " + playercorpse + " to protected corpses.", 0);
                                        mProtectedCorpses.Add(playercorpse);
                                    }

                                }
                            } else if (msg.EndsWith("DTLN")) {
                                msg += "= Air (West)";
                                wtcw(msg, e.Color);
                                e.Eat = true;
                            } else if (msg.EndsWith("DBTNK")) {
                                msg += " = Water (South)";
                                wtcw(msg, e.Color);
                                e.Eat = true;
                            } else if (msg.EndsWith("NTLN")) {
                                msg += " = Fire (North)";
                                wtcw(msg, e.Color);
                                e.Eat = true;
                            } else if (msg.EndsWith("ZTNK")) {
                                msg += " = Earth (East)";
                                wtcw(msg, e.Color);
                                e.Eat = true;
                            }
                            break;
                        case 7:
                            //spellcasting
                            if (mPluginConfig.FilterSpellcasting && msg.StartsWith("The spell")) {
                                e.Eat = true;
                            } else if (mPluginConfig.FilterSpellsExpire && msg.EndsWith("has expired.")) {
                                e.Eat = true;
                                // resists your spell
                            } else if (mPluginConfig.FilterChatResists && msg.StartsWith("You resist the spell")) {
                                e.Eat = true;

                            }
                            break;
                        case 17:
                            if (msg.IndexOf("Cruath Quareth") >= 0) {
                                mSpellwords = "Cruath Quareth";
                            } else if (msg.IndexOf("Cruath Quasith") >= 0) {
                                mSpellwords = "Cruath Quasith";
                            } else if (msg.IndexOf("Equin Opaj") >= 0) {
                                mSpellwords = "Equin Opaj";
                            } else if (msg.IndexOf("Equin Ozael") >= 0) {
                                mSpellwords = "Equin Ozael";
                            } else if (msg.IndexOf("Equin Ofeth") >= 0) {
                                mSpellwords = "Equin Ofeth";
                            } else if (mPluginConfig.FilterSpellcasting) {
                                if (msg.StartsWith("The spell")) {
                                    e.Eat = true;
                                } else if (msg.StartsWith("You say, ")) {
                                    e.Eat = true;
                                } else if (msg.IndexOf("says,\"") > 0) {
                                    e.Eat = true;
                                }
                            }

                            break;
                        case 21:
                            //melee evades
                            if (mPluginConfig.FilterChatMeleeEvades) {
                                if (msg.IndexOf("You evaded") >= 0) {
                                    e.Eat = true;
                                }
                            }
                            break;
                        case 3:
                            if (mPluginConfig.FilterTellsMerchant | mPluginConfig.notifytells) {
                                string actorname = actornamefromtell(msg);

                                WorldObject cursel = Core.WorldFilter[Host.Actions.CurrentSelection];
                                WorldObjectCollection actors = Core.WorldFilter.GetByName(actorname);

                                bool vendorTell = false;
                                bool npcTell = false;

                                //multipe actors possible?
                                foreach (WorldObject x in actors) {
                                    if (x.ObjectClass == ObjectClass.Npc) {
                                        npcTell = true;
                                    } else if (x.ObjectClass == ObjectClass.Vendor) {
                                        vendorTell = true;
                                    }
                                }

                                if (mPluginConfig.FilterTellsMerchant && vendorTell) {
                                    e.Eat = true;
                                    return;
                                }

                                if (mPluginConfig.notifytells & !vendorTell & !npcTell) {

                                    if (cursel == null || ((!(msg.IndexOf(cursel.Name) >= 0)))) {
                                        PlaySoundFile("rcvtell.wav", mPluginConfig.wavVolume);

                                    }

                                }

                            }
                            break;
                    }
                }

            } catch (Exception ex) {
                Util.ErrorLogger(ex);
            }
        }