UNPKG

sgtcloud-html5-sdk

Version:

A html5 out-of-box sdk for damn cool mbaas

2 lines 67.2 kB
function $JsonRpc(e){this.data=e,this.call=function(e,t,r,n){jsonRPC.setup({endPoint:this.data.ajaxUrl,namespace:""}),jsonRPC.request(e,{params:t,success:r,error:n})}}jsonRPC=new Object({version:"2.0",endPoint:null,namespace:null,setup:function(e){return this.endPoint=e.endPoint,this.namespace=e.namespace,this.cache=void 0!==e.cache?e.cache:!0,this},request:function(e,t){return void 0===t&&(t={id:1}),void 0===t.id&&(t.id=1),void 0===t.cache&&(t.cache=this.cache),this._doRequest(JSON.stringify(this._requestDataObj(e,t.params,t.id)),t),!0},_requestDataObj:function(e,t,r){var n={jsonrpc:this.version,method:this.namespace?this.namespace+"."+e:e,id:r};return void 0!==t&&(n.params=t),n},_requestUrl:function(e,t){return e=e||this.endPoint,t||(e+=e.indexOf("?")<0?"?tm="+(new Date).getTime():"&tm="+(new Date).getTime()),e},_doRequest:function(e,t){var r=this,n=new XMLHttpRequest;n.onreadystatechange=function(){4==n.readyState&&(200==n.status?r._requestSuccess.call(r,n.responseText,t.success,t.error):r._requestError.call(r,n.responseText,t.error))},n.open("POST",this._requestUrl(this.endPoint||t.url,t.cache),!1);for(var a=[{name:"Accept",type:"application/json, text/javascript, */*;"},{name:"Content-Type",type:"application/json-rpc"}],i=0;i<a.length;i++)n.setRequestHeader(a[i].name,a[i].type);n.send(e)},_requestError:function(responseText,error){if(void 0!==error&&"function"==typeof error)if("string"==typeof responseText)try{error(eval("("+responseText+")"))}catch(e){error(this._response())}else error(this._response())},_requestSuccess:function(e,t,r){var n=this._response(e);return n.error&&"function"==typeof r?void r(n):void("function"==typeof t&&t(n))},_response:function(responseText){if(void 0===responseText)return{error:"Internal server error",version:"2.0"};try{return"string"==typeof responseText&&(responseText=eval("("+responseText+")")),responseText}catch(e){return{error:"Internal server error: "+e,version:"2.0"}}}}),SgtApi=$S={},SgtApi.entity={User:function(){this.nickName=null,this.password=null,this.userId=null,this.userName=null,this.email=null,this.createTime=null,this.iccid=null,this.imei=null,this.lastLoginTime=null,this.mac=null,this.phoneNumber=null,this.registryType=0,this.updateTime=null,SgtApi.entity.User.prototype.AUTO=0,SgtApi.entity.User.prototype.MANUAL=0,SgtApi.entity.User.prototype.PHONENUMBER=0},Player:function(){this.customId=null,this.equip=null,this.id=0,this.lastLoginTime=null,this.level=1,this.name=null,this.serverId=null,this.type=null,this.userId=null,this.vip=0,this.friendsMaxNumber=0,this.gender=0,this.money=0},Save:function(){this.content=null,this.downFlag=null,this.id=null,this.lastUploadTime=null,this.playerId=null,SgtApi.entity.Save.prototype.ALLOW_DOWN=0,SgtApi.entity.Save.prototype.DENY_DOWN=0},Mail:function(){this.attachment=null,this.attachStatus=0,this.content=null,this.fromId=null,this.fromName=null,this.id=null,this.sendTime=(new Date).getTime(),this.status=SgtApi.config.Mail_TYPE_NOREAD,this.title=null,this.toId=null,this.toName=null,this.type=0,SgtApi.entity.Mail.prototype.DELETED=0,SgtApi.entity.Mail.prototype.READ=0,SgtApi.entity.Mail.prototype.STATUS_ATTACH_NO_PICK=0,SgtApi.entity.Mail.prototype.STATUS_ATTACH_PICKED=0,SgtApi.entity.Mail.prototype.TYPE_INVITATE_FRIENDSHIP=0,SgtApi.entity.Mail.prototype.TYPE_NORMAL=0,SgtApi.entity.Mail.prototype.TYPE_SYSTEM=0,SgtApi.entity.Mail.prototype.TYPE_SYSTEM_REWARD=0,SgtApi.entity.Mail.prototype.UNREAD=0},Ticket:function(){this.content=null,this.createTime=(new Date).getTime(),this.feedbackInfo=null,this.id=0,this.senderPlayerId=null,this.status=1,this.targetPlayerId=null,this.title=null,this.type=1,SgtApi.entity.Ticket.prototype.STATUS_OF_PENDING=0,SgtApi.entity.Ticket.prototype.STATUS_OF_PROCESSED=0,SgtApi.entity.Ticket.prototype.TYPE_OF_NORMAL=0},Achievement:function(){this.currentProgress=0,this.customCondition=null,this.description=null,this.goal=0,this.id=0,this.level=0,this.name=null,this.overMaxProgress=!1,this.preAchievementId=null,this.reward=null,this.showDone=0,this.status=0,this.type=null,this.updateUnfinished=!1,this.visibility=0,SgtApi.entity.Achievement.prototype.PROGRESS_DONE=0,SgtApi.entity.Achievement.prototype.PROGRESS_GOT_REWARD=0,SgtApi.entity.Achievement.prototype.PROGRESS_NOT_ACHIEVED=0,SgtApi.entity.Achievement.prototype.STATUS_DISABLE=0,SgtApi.entity.Achievement.prototype.STATUS_ENABLE=0,SgtApi.entity.Achievement.prototype.VISIBILITY_INVISIBLE=0,SgtApi.entity.Achievement.prototyep.VISIBILITY_VISIBLE=0},Announcement:function(){this.content=null,this.endTime=0,this.startTime=0,this.state=0,this.title=null,this.type=0,this.uuid=null,this.version=0,SgtApi.entity.Announcement.prototype.ACTIVITY=0,SgtApi.entity.Announcement.prototype.BULLETIN=0,SgtApi.entity.Announcement.prototype.MAINTAIN=0},Blacklist:function(){this.blacklistId=null,this.channelId=null,this.description=null,this.id=0,this.name=null,this.type=0,SgtApi.entity.Blacklist.prototype.TYPE_OF_NORMAL=0,SgtApi.entity.Blacklist.prototype.TYPE_OF_ROUTE=0},Boss:function(){this.hp=0,this.id=0,this.intensity=null,this.name=null,this.rewards=null,this.type=0,SgtApi.entity.Boss.prototype.PRIVATE=0,SgtApi.entity.Boss.prototype.PUBLIC=0},Campaign:function(){this.bossIds=null,this.brief=null,this.endTime=0,this.icon=null,this.id=0,this.leaderboardIds=null,this.progress=0,this.rewardContent=null,this.rewards=null,this.startTime=0,this.title=null,this.type=null},CampaignDetail:function(){this.campaign=null,this.campaignId=0,this.description=null,this.id=0,this.script=null},Channel:function(){this.channelId=null,this.id=0,this.name=null},ChargeLog:function(){this.chargeCost=0,this.chargePointId=null,this.chargeText=null,this.chargeTime=0,this.firstCharge=0,this.id=0,this.notes=null,this.orderId=null,this.playerId=null,this.purchaseToken=null,this.result=0,this.storeName=null,this.totalChargeCost=0},ChargePoint:function(){this.amount=0,this.billingCode=null,this.customId=null,this.description=null,this.extraAmount=0,this.firstChargeRewardAmount=0,this.id=0,this.money=0,this.name=null,this.other=null,this.purchanseTimes=0,this.recommendation=0,this.status=0,this.timesLimit=0,this.type=null,this.vipScore=0},CheckinBoard:function(){this.checkinBoardId=null,this.endTime=0,this.id=0,this.maxCheckinTimes=0,this.name=null,this.resetTime=0,this.reward=null,this.startTime=0,this.tag=null,this.type=0,SgtApi.entity.CheckinBoard.prototype.CHECKIN_TYPE_CALENDAR=0,SgtApi.entity.CheckinBoard.prototype.CHECKIN_TYPE_DAILY=0,SgtApi.entity.CheckinBoard.prototype.CHECKIN_TYPE_MONTH=0,SgtApi.entity.CheckinBoard.prototype.CHECKIN_TYPE_NORMAL=0,SgtApi.entity.CheckinBoard.prototype.CHECKIN_TYPE_WEEKS=0,SgtApi.entity.CheckinBoard.protptype.DAILY=0,SgtApi.entity.CheckinBoard.prototype.NOMARL=0},CheckinResult:function(){this.accumlateCount=0,this.checkinBoardId=null,this.countinuousCount=0,this.lastCheckinTime=0,this.rewards=null},DailyTask:function(){this.available=1,this.campaignId=0,this.currentProgress=0,this.description=null,this.endTime=0,this.goal=0,this.id=null,this.minLevel=0,this.name=null,this.nextTaskId=null,this.overMaxProgress=!1,this.preTaskId=null,this.reward=null,this.showDone=!0,this.startTime=0,this.status=0,this.type=null,this.updateUnfinished=!1,SgtApi.entity.DailyTask.prototype.STATUS_PROGRESS_COMPLETED=0,SgtApi.entity.DailyTask.prototype.STATUS_PROGRESS_GOT_REWARD=0,SgtApi.entity.DailyTask.prototype.STATUS_PROGRESS_UNFINISHED=0,SgtApi.entity.DailyTask.prototype.STATUS_TASK_AVAILABLE=0,SgtApi.entity.DailyTask.prototype.STATUS_TASK_UNAVAILABLE=0},ExternalCallbackBean:function(){this.appId=null,this.content=null,this.createTime=0,this.did=null,this.header=null,this.httpCode=0,this.id=0,this.playerId=null,this.serverId=null,this.type=null,this.updateTime=0,this.userId=null},FileItem:function(){this.fileName=null,this.frames=0,this.height=0,this.lastUploadTime=0,this.path=null,this.picType=null,this.size=0,this.type=null,this.width=0},Friendship:function(){this.id=null,this.receiveId=null,this.sendId=null,this.status=0,SgtApi.entity.Friendship.prototype.FRIEND=0,SgtApi.entity.Friendship.prototype.REFUSE=0,SgtApi.entity.Friendship.prototype.STATE_DELETE=0,SgtApi.entity.Friendship.prototype.UN_CONFIRM=0},FriendshipExtra:function(){this.extra=null,this.friendship=null,this.sgpPlayer=null},GachaBox:function(){this.continuousPrice=0,this.description=null,this.endValidTime=0,this.id=0,this.img=null,this.initQuality=0,this.lotteries=null,this.maxQuality=0,this.name=null,this.price=0,this.startValidTime=0,this.timeLimit=0,this.timeLimitErrorMsg=null,this.totalLimit=0,this.totalLimitErrorMsg=null,this.type=null},GachaBoxResult:function(){this.prizes=null,this.quality=0},Gift:function(){this.codeId=null,this.codePrefix=null,this.description=null,this.endTime=0,this.level=0,this.mailTemplateCustomId=null,this.name=null,this.redeemLimit=0,this.reward=null,this.startTime=0,this.uuid=null,this.vip=0},GiftRecord:function(){this.code=null,this.giftId=null,this.playerId=null,this.ticketTime=0,this.uuid=null},Item:function(){this.amount=0,this.customId=null,this.description=null,this.id=0,this.itemId=null,this.itemPurchaseCd=0,this.maxPurchanseTimes=0,this.name=null,this.other=null,this.playerPurchaseCd=0,this.price=0,this.priceUnit=null,this.quality=0,this.status=0,this.storeId=null,this.type=nul,this.weight=0,SgtApi.entity.Item.prototype.DISABLED=0,SgtApi.entity.Item.prototype.ENABLED=0,SgtApi.entity.Item.prototype.TYPE_OF_CHARGE=null,SgtApi.entity.Item.prototype.TYPE_OF_LEVEL=null,SgtApi.entity.Item.prototype.TYPE_OF_MONEY=null,SgtApi.entity.Item.prototype.TYPE_OF_PROPS=null,SgtApi.entity.Item.prototype.TYPE_OF_RESURRECTION=null,SgtApi.entity.Item.prototype.TYPE_OF_VIP=null,SgtApi.entity.Item.prototype.UNIT_OF_CN_YUAN=null,SgtApi.entity.Item.prototype.UNIT_OF_DIAMOND=null,SgtApi.entity.Item.prototype.UNIT_OF_GOLDENCOIN=null,SgtApi.entity.Item.prototype.UNIT_OF_JP_YUAN=null,SgtApi.entity.Item.prototype.UNIT_OF_MONEY=null,SgtApi.entity.Item.prototype.UNIT_OF_US_DOLLAR=null},LeaderBoard:function(){this.activityId=null,this.id=0,this.leaderId=null,this.name=null},LeaderBoardScore:function(){this.index=0,this.player=null,this.score=0},Lottery:function(){this.balance=0,this.id=0,this.name=null,this.prize=null,this.quality=0,this.relatedGachaBox=0,this.weight=0},MailsCollection:function(){this.readedMails=null,this.unreadMails=null},MailTemplate:function(){this.attachment=null,this.content=null,this.customId=null,this.description=null,this.id=0,this.title=null},Message:function(){this.channelId=null,this.content=null,this.createTime=0,this.id=0,this.title=null,this.type=null},Order:function(){this.aggregateAmount=0,this.amounts=1,this.appId=null,this.callbackMessage=null,this.customItemId=null,this.did=null,this.id=0,this.itemId=0,this.playerId=null,this.purchaseTime=0,this.serverId=null,this.status=0,this.storeId=null,SgtApi.entity.Order.prototype.STATUS_OF_DEALING=0,SgtApi.entity.Order.prototype.STATUS_OF_EXCEPTION=0,SgtApi.entity.Order.prototype.STATUS_OF_FAILURE=0,SgtApi.entity.Order.prototype.STATUS_OF_SUCESS=0},PlayerExtra:function(){this.playerId=null},Reward:function(){this.content=null,this.id=0},Server:function(){this.address=null,this.id=null,this.isNew=!1,this.isRecommend=!1,this.name=null,this.state=0,SgtApi.entity.Server.prototype.GOOD=0,SgtApi.entity.Server.prototype.HEAVY=0,SgtApi.entity.Server.prototype.LIGHT=0,SgtApi.entity.Server.prototype.MAINTAIN=0,SgtApi.entity.Server.prototype.ORDINARY=0},Store:function(){this.description=null,this.discount=0,this.id=0,this.items=null,this.status=0,this.storeId=null,this.updateFlag=0,this.version=0,SgtApi.entity.Store.prototype.DEFAULT_DISCOUNT=0,SgtApi.entity.Store.prototype.DISABLED=0,SgtApi.entity.Store.prototype.ENABLED=0,SgtApi.entity.Store.prototype.UPDATE_FLAG_CLOSE=0,SgtApi.entity.Store.prototype.UPDATE_FLAG_OPEN=0},StructuredData:function(){this.id=0,this.key=null,this.name=null,this.type=null,SgtApi.entity.StructuredData.prototype.TYPE_OF_LIST=null,SgtApi.entity.StructuredData.prototype.TYPE_OF_MAP=null,SgtApi.entity.StructuredData.prototype.TYPE_OF_SET=null,SgtApi.entity.StructuredData.prototype.TYPE_OF_VALUE=null,SgtApi.entity.StructuredData.prototype.TYPE_OF_ZSET=null},Task:function(){this.actiontype=null,this.available=1,this.campaignId=0,this.currentProgress=0,this.customCondition=null,this.description=null,this.endTime=0,this.goal=0,this.id=null,this.level=0,this.name=null,this.nextTaskId=null,this.overMaxProgress=!1,this.preTaskId=null,this.reward=null,this.showDone=!0,this.startTime=0,this.status=0,this.taskType=null,this.updateUnfinished=!1,this.visibility=0,SgtApi.entity.Task.prototype.AVAILABLE_DISABLE=0,SgtApi.entity.Task.prototype.AVAILABLE_ENABLE=0,SgtApi.entity.Task.prototype.STATUS_PROGRESS_COMPLETED=0,SgtApi.entity.Task.prototype.STATUS_PROGRESS_GOT_REWARD=0,SgtApi.entity.Task.prototype.STATUS_PROGRESS_UNFINISHED=0,SgtApi.entity.Task.prototype.TASKTYPE_ACHIEVEMENT=null,SgtApi.entity.Task.prototype.TASKTYPE_DAILYTASK=null,SgtApi.entity.Task.prototype.VISIBILITY_INVISIBLE=0,SgtApi.entity.Task.prototype.VISIBILITY_VISIBLE=0},TimerTask:function(){this.className=null,this.createTime=0,this.delay=0,this.desc=null,this.executeTime=0,this.id=0,this.name=null,this.overdueTime=0,this.params=null,this.repeat=0,this.step=0,this.timerId=0},VersionDetail:function(){this.appId=null,this.channel=null,this.description=null,this.forceUpdate=!1,this.id=null,this.name=null,this.type=null,this.updateType=0,this.updateUrl=null,this.version=0,this.versionName=null}},SgtApi.entityFactory=function(entity_name,fn){var entity=eval("new SgtApi.entity."+entity_name+"();");return fn&&""!==fn&&fn(),entity},SgtApi.doRPC=function(e,t,r,n){jsonRPC.setup({endPoint:r,namespace:""}),jsonRPC.request(e,{params:t,success:function(e){return n(!0,e.result)},error:function(e){return console.log("There was an error.error:",e.error),n(!1,e.error.message)}})},SgtApi.context={userData:{},playServerData:{},playerData:{}},SgtApi.config={appGateway:"http://gw.sgtcloud.cn/gateway",appId:"html5_demo2015",channelId:"",userName:null,userPassword:""},SgtApi.init=function(e){"use strict";""!==e.appGateway&&e.appGateway&&(SgtApi.config.appGateway=e.appGateway),""!==e.appId&&e.appId&&(SgtApi.config.appId=e.appId),""!==e.channelId&&e.channelId&&(SgtApi.config.channelId=e.channelId)},SgtApi.UserService={isMatcher:function(e,t,r){var n="isMatcher",a=[e,t],i=SgtApi.config.appGateway+"/user";SgtApi.doRPC(n,a,i,r)},login:function(e,t,r){var n="login",a=[e,t],i=SgtApi.config.appGateway+"/user";SgtApi.doRPC(n,a,i,function(e,t){e?(SgtApi.context.userData=t,SgtApi.UserService.getPlayServer(r)):r(!1,t)})},register:function(e,t){var r="register",n=[e],a=SgtApi.config.appGateway+"/user";SgtApi.doRPC(r,n,a,function(e,r){e?(SgtApi.context.userData=r,t(!0,r)):t(!1,r)})},registerByPhone:function(e,t,r,n){var a="register",i=[e,t,r],o=SgtApi.config.appGateway+"/user";SgtApi.doRPC(a,i,o,function(e,t){e?(SgtApi.context.userData=t,n(!0,t)):n(!1,t)})},resetPassword:function(e,t){var r="resetPassword",n=[e],a=SgtApi.config.appGateway+"/user";SgtApi.doRPC(r,n,a,t)},saveLeaveInfo:function(e,t){var r="saveLeaveInfo",n=[e],a=SgtApi.config.appGateway+"/user";SgtApi.doRPC(r,n,a,t)},sendCaptchaMessage:function(e,t,r){var n="SendMessage",a=[e,t],i=SgtApi.config.appGateway+"/user";SgtApi.doRPC(n,a,i,r)},sendCaptchaMessageByAppId:function(e,t,r,n){var a="SendMessage",i=[e,t,r],o=SgtApi.config.appGateway+"/user";SgtApi.doRPC(a,i,o,n)},updatePasswordByUserName:function(e,t,r){var n="updatePasswordByUserName",a=[e,t],i=SgtApi.config.appGateway+"/user";SgtApi.doRPC(n,a,i,r)},updateUser:function(e,t){var r="updateUser",n=[e],a=SgtApi.config.appGateway+"/user";SgtApi.doRPC(r,n,a,t)},updateUserByUserId:function(e,t,r,n,a){var i="updateUserByUserId",o=[e,t,r,n],s=SgtApi.config.appGateway+"/user";SgtApi.doRPC(i,o,s,a)},updateUserNameAndPassword:function(e,t,r,n){var a="updateUserNameAndPassword",i=[e,t,r],o=SgtApi.config.appGateway+"/user";SgtApi.doRPC(a,i,o,n)},validationToken:function(e,t,r){var n="validationToken",a=[e,t],i=SgtApi.config.appGateway+"/user";SgtApi.doRPC(n,a,i,r)},quickLogin:function(e){var t=localStorage.getItem("sgt-"+SgtApi.config.appId+"-username");if(t){var r=localStorage.getItem("sgt-"+SgtApi.config.appId+"-password");SgtApi.config.userName=t,SgtApi.config.userPassword=r,this.login(t,r,e)}else{for(var n=["0","1","2","3","4","5","6","7","8","9"],a=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],i="",o=0;8>o;o++){var s=0;o>5?(s=Math.ceil(9*Math.random()),i+=n[s]):(s=Math.ceil(61*Math.random()),i+=a[s])}var l=new SgtApi.entity.User;l.userName=i,l.password="yoedge2014",localStorage.setItem("sgt-"+SgtApi.config.appId+"-username",l.userName),localStorage.setItem("sgt-"+SgtApi.config.appId+"-password",l.password),this.register(l,e)}},getPlayServer:function(e){if(null===SgtApi.config.channelId)return e(!1,"channelId未设置!");var t=new $JsonRpc({ajaxUrl:SgtApi.config.appGateway+"/route"});t.call("route",[SgtApi.config.appId,{userId:SgtApi.context.userData.userid,createTime:SgtApi.context.userData.createTime,channelId:SgtApi.config.channelId}],function(t){return console.log("success "+t.result),SgtApi.context.playServerData=t.result,e(!0,SgtApi.context.userData)},function(t){return console.log("There was an error.error[route]:",t.error),e(!1,t.error.message)})}},SgtApi.PlayerService={create:function(e,t){e.lastLoginTime=SgtApi.context.userData.lastLoginTime,e.serverId=SgtApi.context.playServerData.id,e.userId=SgtApi.context.userData.userid;var r="create",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)},deletePlayerByPlayerId:function(e,t){var r="deleteSgpPlayerByPlayerId",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)},downloadSave:function(e,t){var r="downloadSave",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)},getByLastLoginTime:function(e,t,r,n){var a="getByLastLoginTime",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(a,i,o,n)},getByName:function(e,t,r,n){var a="getByName",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(a,i,o,n)},getByUserId:function(e,t){var r="getByUserId",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)},getFriendsMaxNumber:function(e,t){var r="getFriendsMaxNumber",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)},getOneByUserId:function(e,t){var r="getOneByUserId",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)},getPlayerByCustomId:function(e,t){var r="getSgpPlayerByCustomId",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)},getPlayerById:function(e,t){var r="getSgpPlayerById",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)},searchPlayersByLastLogin:function(e,t){var r="searchPlayersByLastLogin",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)},searchPlayersByLastLoginCondition:function(e,t,r,n){var a="searchPlayersByLastLogin",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(a,i,o,n)},setFriendsMaxNumber:function(e,t,r){var n="setFriendsMaxNumber",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(n,a,i,r)},update:function(e,t){var r="update",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)},uploadSave:function(e,t){var r="uploadSave",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/sgpplayer.do";SgtApi.doRPC(r,n,a,t)}},SgtApi.PlayerExtraService={addPlayer:function(e,t){var r="addPlayer",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/playerExtraService.do";SgtApi.doRPC(r,n,a,t)},deletePlayerById:function(e,t){var r="deletePlayerById",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/playerExtraService.do";SgtApi.doRPC(r,n,a,t)},findAll:function(e,t,r){var n="findAll",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/playerExtraService.do";SgtApi.doRPC(n,a,i,r)},findAllByCondition:function(e,t,r,n){var a="findAll",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/playerExtraService.do";SgtApi.doRPC(a,i,o,n)},getPlayerById:function(e,t){var r="getPlayerById",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/playerExtraService.do";SgtApi.doRPC(r,n,a,t)},getPlayerList:function(e,t){var r="getPlayerList",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/playerExtraService.do";SgtApi.doRPC(r,n,a,t)},updatePlayerMap:function(e,t){var r="updatePlayer",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/playerExtraService.do";SgtApi.doRPC(r,n,a,t)},updatePlayer:function(e,t,r){var n="updatePlayer",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/playerExtraService.do";SgtApi.doRPC(n,a,i,r)}},SgtApi.AchievementService={achieve:function(e,t,r){var n="achieve",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(n,a,i,r)},complete:function(e,t,r){var n="complete",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(n,a,i,r)},excuteAchievementsByType:function(e,t,r){var n="excuteAchievementsByType",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(n,a,i,r)},customAchievementsByType:function(e,t,r,n){var a="excuteAchievementsByType",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(a,i,o,n)},getAchievementById:function(e,t){var r="getAchievementById",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(r,n,a,t)},getAchievementsByType:function(e,t,r){var n="getAchievementsByType",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(n,a,i,r)},getAllAchievements:function(e){var t="getAllAchievements",r=[],n=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(t,r,n,e)},getAvailableAchievements:function(e,t){var r="getAvailableAchievements",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(r,n,a,t)},getCompleteAchievements:function(e,t){var r="getCompleteAchievements",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(r,n,a,t)},getDoneAchievements:function(e,t){var r="getDoneAchievements",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(r,n,a,t)},setAchievementProgress:function(e,t,r,n){var a="setAchievementProgress",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(a,i,o,n)},setAchievementsProgressByType:function(e,t,r,n){var a="setAchievementsProgressByType",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/achievement.do";SgtApi.doRPC(a,i,o,n)}},SgtApi.AnnouncementService={getAnnounceByType:function(e,t){var r="getAnnounceByType",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/announcement.do";SgtApi.doRPC(r,n,a,t)}},SgtApi.CampaignService={getAvailableCampaigns:function(e){var t="getAvailableCampaigns",r=[],n=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/campaign.do";SgtApi.doRPC(t,r,n,e)},getByTimeZone:function(e,t,r){var n="getByTimeZone",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/campaign.do";SgtApi.doRPC(n,a,i,r)},getCampaignById:function(e,t){var r="getCampaignById",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/campaign.do";SgtApi.doRPC(r,n,a,t)},getCampaignDetaiByCId:function(e,t){var r="getCampaignDetaiByCId",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/campaign.do";SgtApi.doRPC(r,n,a,t)},getCampaignDetaiById:function(e,t){var r="getCampaignDetaiById",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/campaign.do";SgtApi.doRPC(r,n,a,t)},getCampaignProgress:function(e,t,r){var n="getCampaignProgress",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/campaign.do";SgtApi.doRPC(n,a,i,r)},updateProgress:function(e,t,r,n){var a=[e,t,r],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/campaign.do";SgtApi.doRPC(name,a,i,n)}},SgtApi.CheckinBoardService={url:null,playerid:null,init:function(e){return null===SgtApi.context.playServerData?(console.log("There was an error:","没获取角色服务器信息!"),!1):null===e?(console.error("playerid is null"),!1):(this.playerid=e,this.url=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/checkinboard.do",!0)},checkin:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("checkin",[this.playerid,SgtApi.config.CheckInBoardId],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},accumlateCount:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("accumlateCount",[this.playerid,SgtApi.config.CheckInBoardId],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},countinuousCount:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("countinuousCount",[this.playerid,SgtApi.config.CheckInBoardId],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},getCheckinboardByChekinboardId:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getCheckinboardByChekinboardId",[SgtApi.config.CheckInBoardId],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},getLastCheckinTime:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getLastCheckinTime",[this.playerid,SgtApi.config.CheckInBoardId],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},getRewardByChekinBoardId:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getRewardByChekinboardId",[SgtApi.config.CheckInBoardId],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},setCheckinTimes:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("setCheckinTimes",[this.playerid,SgtApi.config.CheckInBoardId,e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},validateCheckin:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("validateCheckin",[this.playerid,SgtApi.config.CheckInBoardId],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},getAvailableCheckinBoards:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getAvailableChekinboards",[],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},getAvailableCheckinBoardsByTag:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getAvailableChekinboardsByTag",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},getAvailableCheckinBoardsByType:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getAvailableChekinboardsByType",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})}},SgtApi.DailyTaskService={excuteTask:function(e,t,r){var n="excuteTask",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/dailytask.do";SgtApi.doRPC(n,a,i,r)},excuteTasksByType:function(e,t,r){var n="excuteTasksByType",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/dailytask.do";SgtApi.doRPC(n,a,i,r)},addexcuteTasksByType:function(e,t,r,n){var a="excuteTasksByType",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/dailytask.do";SgtApi.doRPC(a,i,o,n)},getDailyTasks:function(e,t){var r="getDailyTasks",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/dailytask.do";SgtApi.doRPC(r,n,a,t)},getDailyTasksByType:function(e,t,r){var n="getDailyTasksByType",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/dailytask.do";SgtApi.doRPC(n,a,i,r)},getReward:function(e,t,r){var n="getReward",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/dailytask.do";SgtApi.doRPC(n,a,i,r)},setTaskProgress:function(e,t,r,n){var a="setTaskProgress",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/dailytask.do";SgtApi.doRPC(a,i,o,n)},setTasksProgressByType:function(e,t,r,n){var a="setTasksProgressByType",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/dailytask.do";SgtApi.doRPC(a,i,o,n)}},SgtApi.TaskService={addActionCount:function(e,t,r){var n="addActionCount",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)},addActionCountTime:function(e,t,r,n){var a="addActionCount",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(a,i,o,n)},complete:function(e,t,r){var n="complete",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)},getAchievementById:function(e,t){var r="getAchievementById",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(r,n,a,t)},getAchievements:function(e,t,r){var n="getAchievements",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)},getAchievementsByType:function(e,t){var r="getAchievementsByType",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(r,n,a,t)},getActionCount:function(e,t,r){var n="getActionCount",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)},getAllAchievements:function(e){var t="getAllAchievements",r=[],n=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(t,r,n,e)},getAllDailyTasks:function(e){var t="getAllDailyTasks",r=[],n=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(t,r,n,e)},getAllTasks:function(e,t){var r="getAllTasks",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(r,n,a,t)},getCompleteAchievements:function(e,t,r){var n="getCompleteAchievements",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)},getCompleteDailyTasks:function(e,t,r){var n="getCompleteDailyTasks",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)},getCompleteTasks:function(e,t,r,n){var a="getCompleteTasks",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(a,i,o,n)},getDailyTaskById:function(e,t){var r="getDailyTaskById",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(r,n,a,t)},getDailyTasks:function(e,t,r){ var n="getDailyTasks",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)},getDailyTasksByType:function(e,t){var r="getDailyTasksByType",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(r,n,a,t)},getDoneAchievements:function(e,t,r){var n="getDoneAchievements",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)},getDoneDailyTasks:function(e,t,r){var n="getDoneDailyTasks",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)},getDoneTasks:function(e,t,r,n){var a="getDoneTasks",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(a,i,o,n)},getReward:function(e,t,r){var n="getReward",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)},getTaskById:function(e,t){var r="getTaskById",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(r,n,a,t)},getTasks:function(e,t,r,n){var a="getTasks",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(a,i,o,n)},getTasksStatus:function(e,t,r,n,a){var i="getTasks",o=[e,t,r,n],s=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(i,o,s,a)},getTasksByType:function(e,t,r){var n="getTasksByType",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/task.do";SgtApi.doRPC(n,a,i,r)}},SgtApi.FriendshipService={acceptInvite:function(e,t,r){var n="acceptInvite",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(n,a,i,r)},acceptInviteByMail:function(e,t,r){var n="acceptInvite",a=[e,t,r],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(n,a,i,callback)},getDenied:function(e,t,r,n){var a="getDenied",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(a,i,o,n)},getFrindsCount:function(e,t){var r="getFrindsCount",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(r,n,a,t)},getInvite:function(e,t){var r="getInvite",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(r,n,a,t)},getMyFriends:function(e,t,r,n){var a="getMyFriends",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(a,i,o,n)},getNotConfirm:function(e,t){var r="getNotConfirm",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(r,n,a,t)},invite:function(e,t,r){var n="invite",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(n,a,i,r)},inviteByMails:function(e,t,r,n){var a="invite",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(a,i,o,n)},isMyfriend:function(e,t,r){var n="isMyfriend",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(n,a,i,r)},refuse:function(e,t,r){var n="refuse",a=[myId,otherId],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(n,a,i,r)},unfriend:function(e,t,r){var n="unfriend",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendship.do";SgtApi.doRPC(n,a,i,r)}},SgtApi.FriendshipExtraService={getAllMyFriendsAndExt:function(e,t,r,n,a){var i="getAllMyFriendsAndExt",o=[e,t,r,n],s=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendshipextra.do";SgtApi.doRPC(i,o,s,a)},getMyFriendAndExt:function(e,t,r){var n="getMyFriendAndExt",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendshipextra.do";SgtApi.doRPC(n,a,i,r)},updateAllMyFriendExt:function(e,t,r,n){var a="getMyFriendAndExt",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendshipextra.do";SgtApi.doRPC(a,i,o,n)},updateMyFriendAllExt:function(e,t,r,n){var a="updateMyFriendAllExt",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendshipextra.do";SgtApi.doRPC(a,i,o,n)},updateMyFriendExt:function(e,t,r,n,a){var i="updateMyFriendExt",o=[e,t,r,n],s=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/friendshipextra.do";SgtApi.doRPC(i,o,s,a)}},SgtApi.BlackListService={addPlayerIntoBlackList:function(e,t,r){var n="addPlayerIntoBlackList",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/blacklist.do";SgtApi.doRPC(n,a,i,r)},isInBlackList:function(e,t,r){var n="isInBlackList",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/blacklist.do";SgtApi.doRPC(n,a,i,r)}},SgtApi.GachaBoxService={autobalanceDraw:function(e,t,r,n){var a="autobalanceDraw",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/gachabox.do";SgtApi.doRPC(a,i,o,n)},autobalanceDrawQuality:function(e,t,r,n,a){var i="autobalanceDraw",o=[e,t,r],s=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/gachabox.do";SgtApi.doRPC(i,o,s,a)},autobalanceDrawMaxQuality:function(e,t,r,n,a,i){var o="autobalanceDraw",s=[e,t,a,r],l=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/gachabox.do";SgtApi.doRPC(o,s,l,i)},draw:function(e,t,r,n){var a="draw",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/gachabox.do";SgtApi.doRPC(a,i,o,n)},getAvailableGachaBox:function(e){var t="getAvailableGachaBox",r=[],n=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/gachabox.do";SgtApi.doRPC(t,r,n,e)},getGachaBoxByName:function(e,t){var r="getGachaBoxByName",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/gachabox.do";SgtApi.doRPC(r,n,a,t)},getLotteriesByGachaBoxId:function(e,t){var r="getLotteriesByGachaBoxId",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/gachabox.do";SgtApi.doRPC(r,n,a,t)},limitDraw:function(e,t,r,n){var a="limitDraw",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/gachabox.do";SgtApi.doRPC(a,i,o,n)}},SgtApi.LeaderBoardService={addUpLeaderBoardScore:function(e,t,r,n){var a="addUpLeaderBoardScore",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/leaderboard.do";SgtApi.doRPC(a,i,o,n)},getLeaderBoardByLeaderId:function(e,t){var r="getLeaderBoardByLeaderId",n=[e],a=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/leaderboard.do";SgtApi.doRPC(r,n,a,t)},getLeaderBoardScoreByExample:function(e,t,r){var n="getLeaderBoardScoreByExample",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/leaderboard.do";SgtApi.doRPC(n,a,i,r)},getLeaderBoardScoreByLeaderIdAndPlayerId:function(e,t,r){var n="getLeaderBoardScoreByLeaderIdAndPlayerId",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/leaderboard.do";SgtApi.doRPC(n,a,i,r)},getLeaderBoardScoresByLeaderIdAndPlayerId:function(e,t,r){var n="getLeaderBoardScoresByLeaderIdAndPlayerId",a=[e,t],i=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/leaderboard.do";SgtApi.doRPC(n,a,i,r)},getTopLeaderBoardScoreByLeaderId:function(e,t,r,n){var a="getTopLeaderBoardScoreByLeaderId",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/leaderboard.do";SgtApi.doRPC(a,i,o,n)},submitLeaderBoardScore:function(e,t,r,n){var a="submitLeaderBoardScore",i=[e,t,r],o=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/leaderboard.do";SgtApi.doRPC(a,i,o,n)}},SgtApi.MailService={url:null,playerData:null,init:function(e){return null===SgtApi.context.playServerData?(console.log("There was an error:","没获取角色服务器信息!"),!1):null===e||"undefined"==typeof e?!1:(this.playerData=e,this.url=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/mail.do",!0)},sendMail:function(e,t){if(""===e.title||null===e.title)return t(!1,"邮件标题不能为空!");if(""===e.toId||null===e.toId)return t(!1,"收邮件人ID不能为空!");if(""===e.toName||null===e.toName)return t(!1,"收邮件人名字不能为空!");e.fromId=this.playerData.id,e.fromName=this.playerData.name;var r=new $JsonRpc({ajaxUrl:this.url});r.call("send",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},receive:function(e,t,r,n){(0>e||null===e)&&(e=1),(0>t||null===t)&&(t=5);var a=new $JsonRpc({ajaxUrl:this.url});a.call("receive",[e,t,this.playerData.id,r],function(e){return n(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),n(!1,e.error.message)})},receiveUnread:function(e){var t=0,r=null;r=cc.sys?cc.sys.localStorage:window.localStorage;var n=r.getItem("receiveUnread");"undefined"!=typeof n&&n&&""!==n&&(t=parseInt(n));var a=new $JsonRpc({ajaxUrl:this.url});a.call("receiveUnread",[t,this.playerData.id],function(t){return r.setItem("receiveUnread",Math.round((new Date).getTime()/1e3)),e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},readMail:function(e,t){if(null===e)return t(!1,"ID为空!");var r=new $JsonRpc({ajaxUrl:this.url});r.call("read",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},readAndPickAttachment:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("readAndPickAttachment",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},deleteMail:function(e,t){if(null===e)return t(!1,"ID为空!");var r=new $JsonRpc({ajaxUrl:this.url});r.call("delete",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},getReadedAndUnreadedMails:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getReadedAndUnreadedMails",[this.playerData.id],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},pickAttachment:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("pickAttachment",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})}},SgtApi.Notification={url:null,playid:null,init:function(e){return null===SgtApi.context.playServerData?(console.log("There was an error:","没获取角色服务器信息!"),!1):e&&"undefined"!=typeof e?(this.playid=e,this.url=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/notification.do",!0):(console.log("There was an error:playid is null"),!1)},getLatestNotification:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});e?r.call("getLatestNotification",[this.playid,e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)}):r.call("getLatestNotification",[this.playid],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})}},SgtApi.Purchase={url:null,playid:null,init:function(e){return null===SgtApi.context.playServerData?(console.log("There was an error:","没获取角色服务器信息!"),!1):e&&"undefined"!=typeof e?(this.playid=e,this.url=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/purchase.do",!0):(console.log("There was an error:playid is null"),!1)},getSupportedStores:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getSupportedStores",[],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},getAvailableChargePoints:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getAvailableChargePoints",[this.playid],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},getPaymentResult:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getPaymentResult",[this.playid,e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},getTotalChargeCost:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getTotalChargeCost",[this.playid],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},isFirstCharge:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("isFirstCharge",[this.playid,e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},getChargeTimes:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getChargeTimes",[this.playid,e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})}},SgtApi.StoreService={url:null,playid:null,init:function(e){return null===SgtApi.context.playServerData?(console.log("There was an error:","没获取角色服务器信息!"),!1):e&&"undefined"!=typeof e?(this.playid=e,this.url=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/store.do",!0):(console.log("There was an error:playid is null"),!1)},getDefaultStore:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getDefaultStore",[this.playid],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},getStore:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getStore",[e,this.playid],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},purchase:function(e,t,r,n,a){var i=new $JsonRpc({ajaxUrl:this.url});i.call("purchase",[this.playid,e,t,r,n],function(e){return a(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),a(!1,e.error.message)})},countStoreOrdersByPlayerId:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("countStoreOrdersByPlayerId",[this.playid,e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},countItemOrdersByPlayerId:function(e,t,r){var n=new $JsonRpc({ajaxUrl:this.url});n.call("countItemOrdersByPlayerId",[this.playid,e,t],function(e){return r(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),r(!1,e.error.message)})},getOrderById:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getOrderById",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},getLastPurchaseTimeMillis:function(e,t,r){var n=new $JsonRpc({ajaxUrl:this.url});n.call("getLastPurchaseTimeMillis",[this.playid,e,t],function(e){return r(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),r(!1,e.error.message)})},updateOrderStatus:function(e,t,r,n){var a=new $JsonRpc({ajaxUrl:this.url});a.call("updateOrderStatus",[e,t,r],function(e){return n(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),n(!1,e.error.message)})}},SgtApi.ChargePoint={url:null,init:function(){return null===SgtApi.context.playServerData?(console.log("There was an error:","没获取角色服务器信息!"),!1):(this.url=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/chargepoint.do",!0)},getAllChargePoints:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getAllChargePoints",[],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})},getAvailableChargePoints:function(e){var t=new $JsonRpc({ajaxUrl:this.url});t.call("getAvailableChargePoints",[],function(t){return e(!0,t.result)},function(t){return console.log("There was an error.error:",t.error),e(!1,t.error.message)})}},SgtApi.BossService={url:null,playerid:null,init:function(e){return null===SgtApi.context.playServerData?(console.log("There was an error:","没获取角色服务器信息!"),!1):null===e?!1:(this.playerid=e,this.url=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/boss.do",!0)},getByBossIdstr:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getByBossIds",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},getByBossIdint:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getByBossIds",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},getByBossId:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getByBossId",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},attack:function(e,t,r){var n=new $JsonRpc({ajaxUrl:this.url});n.call("attack",[e,t,this.playerid],function(e){return r(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),r(!1,e.error.message)})},getCurrentHP:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getCurrentHP",[e,this.playerid],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},getLastAttackPlayer:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getLastAttackPlayer",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})}},SgtApi.FileStorage={url:null,init:function(){return null===SgtApi.context.playServerData?(console.log("There was an error:","没获取角色服务器信息!"),!1):(this.url=SgtApi.context.playServerData.address+"/"+SgtApi.config.appId+"/filestorage.do",!0)},getUrl:function(e,t){var r=new $JsonRpc({ajaxUrl:this.url});r.call("getUrl",[e],function(e){return t(!0,e.result)},function(e){return console.log("There was an error.error:",e.error),t(!1,e.error.message)})},"delete":function(e,t){var r=new $JsonRpc({ajaxUrl:this.