定义类,GM工具脚本
来源:互联网 发布:网络拓扑分层的好处 编辑:程序博客网 时间:2024/04/20 03:31
# -*- coding: cp936 -*-import urllibimport urllib2import time__metaclass__=typeclass CheckItem: def __init__(self): self.dic={} filename = raw_input('输入物品名称表:') + '.txt' with open(filename,'r') as f: lines = f.readlines() for line in lines: temp = line.strip('\n').split('\t') temp_key = '['+temp[0]+','+temp[1]+','+temp[2]+']' temp_val = temp[3] self.dic[temp_key]=temp_val def checkDic(self): filename = raw_input('输入奖励物品:') + '.txt' with open(filename,'r') as f: lines = f.readlines() for line in lines: line_list = eval(line) temp = '['+str(line_list[0])+','+str(line_list[1])+','+str(line_list[2])+']' num = line_list[3] #print temp try: print self.dic[temp]+'x'+ str(num) except (KeyError),e: print 'ID:%s not find' % eclass GmTool: def __init__(self): self.url='http://xxx.xxx.xxx' self.value = { 'AreaID':'1', 'Uid':None, 'Name':'', 'Type':None, 'SubType':None, 'ID':None, 'Count':None, 'Lock':'0' } self.UUID = raw_input('输入角色ID:') def __postMsg(self,UUID,params): self.value['Uid']=UUID self.value['Type']=params[0] self.value['SubType']=params[1] self.value['ID']=params[2] try: self.value['Count']=params[3] except IndexError: self.value['Count']=10 #print self.value data = urllib.urlencode(self.value) req = urllib2.Request(self.url,data) urllib2.urlopen(req) def sendByInput(self): while True: print '----------------------------' putin = raw_input('输入道具ID、数量:') if not putin:break if '\t' in putin: putin = putin.replace('\t','.') temp = putin.split('.') #temp = tuple(temp) self.__postMsg(self.UUID,temp) def sendByTxt(self): print '----------------------------' filename = raw_input('输入文件名:') + '.txt' #print filename if not filename: return num = raw_input('输入道具数量:') print '道具发送中...' with open(filename,'r') as f: lines = f.readlines() for line in lines: if line=='\n': return temp = line.strip('\n').split('\t') temp.append(str(num)) #print temp self.__postMsg(self.UUID,temp) def sendByCopy(self): print '----------------------------' lines=eval(raw_input('输入合成需要道具:')) if not lines: return for line in lines: if line[0]==0: return temp = line[:4] #print temp self.__postMsg(self.UUID,temp)
0 0
- 定义类,GM工具脚本
- MFC实现的GM工具
- 云中歌一键端+GM工具+架设教程
- nodejs图片处理工具gm用法
- nodejs图片处理工具gm用法
- 岐山ol服务端+完整数据库+GM工具
- GameMonkey脚本语言编程基础——执行GM脚本文件
- 我是死神手游一键端+GM工具+安卓源码
- jquery 定义工具类写法
- 定义字符串工具类StringUtil
- 执行SQL脚本工具类
- 脚本工具
- 绝魂GM
- javascript 通用定义类继承工具方法
- 真封神引擎技术篇之易语言GM工具开发教程第三集
- 真封神引擎技术篇之易语言GM工具开发教程第四集
- node图片处理工具gm的使用:图片水印、图片验证码、图片裁剪示例
- Oracle脚本定义变量
- swift学习_xcode基础学习
- GCD(二)
- 弹出框
- Deepin/Ubuntu/Ubuntukylin/Xubunt/Lubuntu/Kubuntu Android 开发环境配置
- https的URL参数传递中文乱码问题
- 定义类,GM工具脚本
- 黑马程序员——05集合框架
- 完成端口详解
- HTML5 学习记录之浏览器检测是否支持HTML5
- 部署rac 提示ORA
- Google停用MapReduce,高调发布Cloud Dataflow
- traceroute命令
- RabbitMQ之最简单的消息的发送与接收
- linux编译单独一个模块makefile写法